In the earlier post, we have seen that what is hashing in Blockchain. In this post, we’ll discuss what blocks are, why they’re important, and the basics of how they work.
Blocks are the fundamental components of the blockchain. They are buildings blocks of the entire Blockchain. The word “Block” is an interesting way to think about the information it stores; but what a block is, might be a little different than you expect.
A Block is a container that holds a list of transactions to be added to the Blockchain. It is a shared ledger containing a list of all records that happen throughout the network.
If we let this run on forever as one huge list, we will end up with an enormous list of transactions. This would get really difficult to work with or manage. To give more control over this list, the blockchain is split up into smaller sections known as blocks.
As transactions are made, they are bundled together into these blocks and added to the Blockchain. This breaks up the ledger into smaller bite-sized pieces that we can use to manage the entire system more efficiently.
Along with these transactions, blocks also hold some other interesting information. Let’s look at the details of a single block more closely.
While transactions held in the body of the Block, other important information held in the header of the Block. This header contains extra information that includes details about the structure of the data inside the block.
The hash of the previous block, the time the block was made, the Merkle root, and the nonce all sit inside the blocks header. There were some new terms in there, so let’s walk through them now.
1] The previous block’s hash – It is what it sounds like. It’s the hash value for the block that comes directly before the given block in the chain. Having this connection links the blocks together by allowing us to always know what block comes before and after any block on the chain. This is what forms the basis of the entire blockchain.
2] Time – The time of the block was created is also held inside the header. This way, we know exactly when each block was made. That helps us know when certain transactions took place and can help us catch things like when someone may have tried to spend the same money twice. With this information, we can decide which transactions were valid based on which happened first. This timestamp is the Blockchain solution to the double-spending problem.
3] The Merkle root – is a hash that represents every transaction inside the block. To get the Merkle root, pairs of the transactions within the block are repeatedly hashed together. Each pair results in any single hash, then the hash of two pairs of transactions is again hashed together over and over again until you’re left with a single hash value. Given that final hash value known as the Merkle root, you can now reverse the hashing to reconstruct the entire set of transactions from the original block. The nonce has more to do with some topics we’ll cover later related to what’s known as mining.
4] The Nonce – The Nonce is an arbitrary number that can only be used once. When creating a hash for a block, not just any value will work. The system requests a very specific hash value that starts with a certain number of zeros. These extra constraints make the hash more difficult to find. The number of zeros that are requested to solve this problem is known as the difficulty of the block. If more zeros are needed, that’s need more specific request, so it’s more difficult to find.
5] Size – The block size is the amount of space a block has to hold information. Like your computer or phone, there are limits to the amount of space on a block. This amount of space in a block is decided by the developer and helps control things like how long it takes for a block to fill up or how many blocks will be on the chain. Once decided, this will be the same for every block on a given chain, and can only be changed by making updates to the software. If the block size were one megabyte, that means that once this limit is reached, the block is full and it’s time to start generating a new one.
6] Hash – This hash will be the unique fingerprint we can use to identify the block in the future. If data changes even slightly, this will generate a completely new hash value. That means if a transaction changes on the block this hash will also change. This is really important because it lets everyone know when a block has been tampered with. This makes the block chain a secure way to keep a history of information that you can be sure hasn’t been changed without you knowing.
That’s the basic concept of a block, and some terminology to go along with it. In future posts, you’ll learn how this fits into the system and how you can look through the data inside the block yourself.