Blockchain : Block Structure


“Blockchain may change the architecture of the internet itself because of its structure.”

Hello techies, Welcome back.

What ??

Ohh.. above highlighted sentence !! That was I wrote after knowing about a block structure mechanism of the blockchain and I think you also need to know about this.


  • Introduction
  • Hash(Block Identifiers)
  • Block Headers
  • Merkle Tree


In simple words, Block is a box that contains some size of data(“In bitcoin world, this data means a bunch of transactions”) in it.

So, what especially in it?

Answer 1): The way of data storing and securing. (using hash algorithms).

Answer 2): The way of these block are connected together and creates a secure chain. (block headers).

Okay, before we start the understanding of block structure here some knowledge about existing bitcoin blockchain block.

Bitcoin blockchain block contains more than 500 transactions on average and an average size of the block is 1MB(source). Bitcoin used SHA-256 hash algorithm as block identifier.

Hash(Block Identifiers)

Hash is a mathematical algorithm that maps data of capricious size to a bit string of a fixed size. In the case of an SHA-256 hash algorithm, it always produces fix 32 bytes of the string.

In the Blockchain, every block generates one unique hash from data(in bitcoin world, transactions) within it. so, every block is identified by that unique hash string.

Hash algorithms are very case sensitive. Even if you change one bit or space or upper to lowercase or comma added to string then Every time it produces the unique string.

How? let's understand with an example,

I used npm js-sha256 module(npm install js-sha256) to run this example.

I just simply put string “Mahesh Rajput” in a hash function and it will produce hash like :

I tried to change string “Nahesh Rajput” from “Mahesh Rajput” and output is :

Blockchain uses this type of cryptographic mechanism for identifying blocks easily but difficult to hack.

Block Headers

Block headers play an important role to make blockchain immutable. Block headers contain some metadata about a block.

This metadata is :

1) Previous block hash. In blockchain, every block needs previous block hash for its creation because every block inherits from the previous block. It gives much powerful security to blockchain from data tampering.

2) Block mining is a mechanism for checking whether the data in the block is valid or not? And the creation of a new block. This is not the part of our article but we will go deep in this in an upcoming article.

3) The third part is the Merkle tree root. This data structure is used for summarizing data in the block.

This picture gives a nice understanding of block structure. For now, ignore the Nonce and timestamp because these are part of the proof of work that we will go to discuss in next articles.

Okay, now you have a question that all block has previous hash for its creation than what for the first block?

The first block in any blockchain is called as the genesis block. It only block in blockchain that doesn’t refer previous block hash. It defines initial parameters of blockchain like consensus algorithm, difficulty level etc. to mine blocks. Further, we will discuss later.

Merkle Trees

The data(or transactions) in the block are structured in Merkle tree or binary hash tree.

This type of data structure will understand by examples easily so we do some coding for this. Merkle tree structured by doing recursively hashing of a pair of data(nodes), until there is only one hash, called Merkle root hash.

Example: Let’s say, we have a block with six transactions. For easy understanding, all transaction contains some string:

To construct Merkle tree we start from the bottom, first, we take string one by one and hash them.


Merkle tree hashes the pair of nodes until it will get only one hash so, we also do the same thing until we will get the one hash of this four transactions.

Merkle root hash:

So, this is how Merkle tree works. It doesn’t matter how many transactions(nodes) are available in the block it always manages all in 32 bit hah. This is an important part for verifying transactions in a block.

So, guys I just try to explain block structure similar like bitcoin blockchain but bitcoin uses double hash on every transaction for more security.

Okay, this all about what block contains in it. Hope it will help you!!

Post your comment