How do Merkle tree relate to Blockchain?
We know that Blockchain has blocks linked to each other logically. Each block would have thousands of transaction details. Therefore, it would be a complex task to store all of them as a series which is also very time inefficient. In such a series of data, it becomes really cumbersome to find out a particular transaction. This is where the Merkle tree comes into the action. Using a Merkle tree, we can easily identify if that particular transaction belongs to a block or not. It is much faster and greatly cuts down the time.
Let us understand this with a simple example. Suppose we have the following Merkle tree.
Now let us assume that we are in a purpose of finding a particular transaction belonging to a block or not.
Rather than moving through each and every individual block transactions and inspecting the hash, we just need to track it down through hash trials.
It eventually reduces a huge amount of time in the process. A block header plays a significant role in the Bitcoin. The reason is it connects all blocks together.
Generally, a block header is divided into six fields. The version number, the hash of the last block, the Merkle root, Time, Target, Nonce.
The following three factors play a vital role in the process:
Time: It is the timestamp in the block that would show the time in seconds.
Target: It is the Threshold under which the block hash exists.
The Nonce:In the cryptographic communication, the nonce is an arbitrary number that is used only once in it.
Remember that the block header gets incrementally changed in the block while mining so that we get a special hash.