Your First Truffle Dapp — What is the Blockchain – Hugh Knight – Medium

Your First Truffle Dapp — What is the Blockchain – Hugh Knight – Medium

As I was going over my notes and had begun rewriting some of the examples that I’ll be covering as I continue the blog series: Your First Truffle Dapp — An attempt at a beginners guide to the Truffle Framework, something caught my eye. Something that I missed when writing the first couple blog post. I jumped right into truffle and solidity and forget to not only list an import prerequisite, but I also forgot to give you the background knowledge that you needed to continue with the tutorials fully.

Why was it so easily missed. Well, its was missed because I assumed you were like me and had already amassed that knowledge you needed. But what if you didn’t? What if you just jumped into the blog posts and just powered your way through. You would have a general understanding of how to do things, but you might not really know why your doing it or even why it needs to be done. I always find that its helpful, especially when I’m trying to solve a problem, if I’m able to visualize whats happening in my head and walk through it.

So what is this this prerequisite that I’m speaking of? Its the basic understanding of the Blockchain. Being familiar with how it works, why it does certain things, and what steps it takes to get there. As much information as you need to be comfortable with the inner working of the Blockchain. So in this blog post I’m hoping to explain the best I can and maybe along the way I’ll find a bit of knowledge I didn’t know existed by explaining it to you.

Since I don’t really know who is reading this or where you currently stand when it comes to understanding the Blockchain. I’m just going to assume you know nothing, you’ve just heard people mention it before, but your not sure how it all comes together, and how do they chain these blocks together (see what they did there).

Lets start with the pieces that make up the Blockchain or what we like to call the framework. The Blockchain framework, is made up of 9 different pieces:

Blockchain Framework

Now I want you to take a second, take notice that as we cover those pieces of the framework, we wont being going in the order illustrated above. There is actually a reason for that. That is because I do not think we need to cover them in that order, as that order is more of how the system works together with all the pieces to create the Blockchain pieces and not necessarily the fundamental order of the pieces. So what I want to do is start by quickly going over the fundamental pieces from top to bottom and finish with the harder more complex pieces.

Hashing not Hash-tagging

We can start with our first component, which is Hashing. No not hashtag, but hashing. This is something that your going to or have already heard of many times.

So what is hashing or a hash value? To put it simply, it’s a unique string of letters and numbers that represent a set of data or if someone asks you at a party

Its a digital fingerprint for information.

Great! but what if they ask you how you get a hash value or how is it created. Well its simple (make sure to say that also with a smirk on your face), you just start with some information or data and that gets passed through a hashing function, then the hashing function will make that group of data into to a unique hash value by taking that information you passing in and using it to create a completely unique hash value. There you have it, a unique identifier for your original data.

How a hash or hash value is created

By going through this process it allows us to identify a given set of information much more easily by allowing us to reference its hash value. There are different types of hashing functions used by different types of cryptocurrencie projects. I’ll just list a very few below as the list goes on and on, but I wanted to give you a simple idea of who is using what.

Projects and their hashing functions

The reason why we use a hash is that it allows us to create a unique identifier for every block that exits on the chain. We can now use it to reference a particular block by its hash value or even start to create the foundation in which we can join those blocks together into a chain.

Get it? Got it? Good! I wont cover everything in this blog. AS I said, I just wanted to give you an understanding in bit size pieces that allow you to go take the information, think about it, maybe even do some more research on your own and then come back and continue the journey with me. So the final piece that I will cover in this blog post will be blocks. Not to worry, its only for this blog post, there’s still more we can learn to help fully understand the Blockcain framework.

Just another day around the Block

What would a Blockchain be without blocks? Blocks are literally the building blocks of the entire Blockchain. A block is just a container that holds a list of transactions that are to be added to the Blockchain. I’ll cover Blockchain in more details in the next upcoming posts, but a Blockchain is just a shared digital ledger that records a list of transactions that happen throughout the network. Lets think about this for a minute. If we were to take transaction as just a plain list and let them be recorded forever, we would have a massive list of transactions, top to bottom and that would be a nightmare to work with or manage. So what the Blockchain does is that it splits up the transactions into smaller sections that we call blocks, and this gives us more control over our transactions. These transaction are bundled together as blocks and added to the Blockchain to help manage the entire system more efficiently.

What makes a Block

Interestingly enough, not only are transactions stored int the body of a block, but others bits of information are stored in there also. Another piece of that makes up a block, is the block header and this stores other pieces of information that contain details relating to the structure of the data in the block such as:

  • Previous Block Hash — Connects the block to the previous (parent) block in the chain.
  • Timestamp — The approximate creation time of this block (seconds from Unix Epoch).
  • Merkle Root — A hash of the root of the merkle tree of this blocks transactions.
  • Nonce — A counter used for the proof-of-work algorithm.

Although the nounce part of the block header has more to do with mining, there is a bit of information in there that we should probably understand to completely paint this wonderful picture called a block. So to keep things simple, lets put it this way. As I said above the nounce is a counter and has a arbitrary number that can only be used once. When creating a hash for a block, the system requires a very specific hash value, this value starts with a certain amount of zeros. These added values make the hash more difficult to find when mining. In order to get that value you have to combine all the blocks data with the nounce arbitrary number in order to try to generate (the minder does this) correct hash value. Miners will try to solve this problem over and over and over again, until finally one of them comes up with the value that meets this constraint. This is why they call it mining! Miners will try to solve this problem over and over and over again, until finally one of them comes up with the value that meets this constraint. This is why they call it mining! We don’t need to go over it too much right now, we just need to understand how those work. The why will be covered in the future blog posts.

Each block has a difficulty level when it comes to mining, this relates to the nounce. The number of zeros that are requested to solve a block determine the difficulty level of a block. The more zeros that are needed, the harder it is to find that block, and the block difficulty goes up, the less zero’s, the easier a block and block difficulty goes down.

Block Size

What is this thing I keep hearing about block size? Another attribute that a block has is its size. The block size is the amount of space a block has to hold information. Like any pieces of technology that store information, it has its limits when it comes to how much space it has. How the Block size is determined is by the developer(s), and this helps to make decisions like, how many blocks will be on the chain and how long it will take for a block to get full. And this block size is the same for every block on a given Blockchain. With that being said, this can be changed, but only by making updates to the software, or what we know as a fork.

Remember the image about where we described data, going into a hashing function and then producing a hash value, a unique fingerprint we can use to identify that block? An important thing to remember about that is, if data changes even slightly, so does the hash value, and create a completely new hash value. So if a transaction changes on the block, so will the hash. This lets everyone know when a block has been tampered with. This piece of secure functionality within the Blockchain is a really secure way of keeping a history of information that we can be sure of hasn’t been tampered with, without us knowing or finding out.

Final Words

What have we learnt?

  • There are 9 main different pieces that make up a Blockchain framework.
  • Hashing is a unique string of letters and numbers that represent a set of data.
  • A block is just a container that holds a list of transactions that are to be added to the Blockchain.
  • Each block has a difficulty level when it comes to mining.
  • There are different types of hashing functions used by different types of cryptocurrencie projects.

That is it for now. In the next posts I’ll continue along the framework and discuss the other pieces that make up the Blockchain Famework.

Join the conversation, follow us on Twitter: @Tap_Coin, Reddit, or swing by and have a chat with us on Telegram: https://t.co/eIP47QmZ1E to discuss all things Tap Project.

Tap into a world that is more than just gaming!

Published at Mon, 01 Apr 2019 18:11:12 +0000

Welcome to Bitcoin Cryptocurrency Market Capitalizations Price Index

Install
×