So far in this article series, we have discussed the Blockchain, its roadmap, and some of its key concepts. Now, we will be diving a little deep into blockchain and breaking down a single unit or a block in the blockchain and learning about it.
Blockchain Structure
- One can imagine a Blockchain as a linked list. Similar to a Linked List the blocks of a blockchain are connected through something, that something in the linked list is the address of the previous node but in the blockchain, it is the Merkle-Hash value of the previous block, which is stored in the successor block.
An obvious question might arise in your mind, how many blocks
can be present in a blockchain?
The answer is any number of blocks are possible, as long as the
maintainers are good with that. You can check this link to see how many blocks of
some famous blockchains are created to date.Here is an image of Ethereum's block count.
Block Structure
- A block in a blockchain constitutes of two components, Header (which is further divided into six components) and Ledger - the main transaction database. Below is the image to roughly visualize a block in a blockchain.
- The block structure in the image above does not show all the components of the block's head, but I will be listing all of them in the next section.
Block-Header
The Block-Header is an 80 bytes long string consisting of six components -
- Version (4 bytes)
- A hash code of the previous block (32 bytes)
- The current block's Merkle-Hash code value (32bytes)
- Timestamp (4 bytes)
- Bits (4 bytes)
- Nonce value (4 bytes)
Version - It is as the name is the version number of the protocol used in the chain.
Previous block hash - The block header contains a 256-bit long Merkle Hash code value of the previous block to stay connected with the blockchain. The first block in any blockchain is called a Genesis block - A block that doesn't have any previous block hash.
Merkle Hash value - Merkle hash code value of each block is a combination of all the hashes changed during each transaction in a block. It is a 256 bit long Hash code which acts as an identity or name for a block.
Timestamp - Each block contains a Unix time timestamp. In addition to serving as a source of variation for the block hash, they also make it more difficult for an adversary to manipulate the block chain.
Bits - Bits can be understood as a level of difficulty assigned to the miners for the process of proof-of-work. Adding a new block in a blockchain is a tremendously difficult task, miners have to solve a very tough mathematical puzzle (not literally a puzzle) in order to add a block. The difficulty of that puzzle is stored in the Bits field.
Nonce - It is that puzzle that miners are trying to solve extensively to get rewarded. Nonce itself is a full article topic so I will not be emphasizing it too much here.
Block Ledger
The Block ledger contains the details of all the transactions stored in a block. A block can store up to 2000 transactions. The maximum size a block can achieve is 1MB, depending upon the number of transactions recorded in a particular block. As long as the chain length increases it becomes impossible to update or manipulate these transactions and this makes the blockchain immutable.
Conclusion
That was all about the block structure of a blockchain, I covered all the components of the block's structure. Hope you like the article. More articles on this series coming every week, so stay tuned.
Top comments (3)
Awaiting nonce article.
That I will cover in the article of Miners and how do they mine a block.
Ever thought of how a single block looks like in a blockchain. Have a look on the article.