Overview:
A Merkle Tree is a tree where every leaf node is hash of data block and every non leaf node is a cryptographic hash of its children. Following diagram demonstrate the structure of the Merkle Tree:

Above diagram is an example of binary Merkle tree but the data structure is not restricted and it is possible to have n-nary Merkle tree as well. There have been extensive use of this data structure in blockchain technology especially in Bitcoin and Ethereum.
How it is used in Bitcoin:
Every transaction that happens on Bitcoin network is stored in blocks. These data blocks contain multiple transactions and each transaction is eventually hashed. Every two hashed values are again hashed together and stored in its parent node. The root of the tree also known as Merkle Root stores the hash based on all transaction in block.
This merkle root of the block is stored in the block header and used as one of the input parameters to calculate the hash of entire block.
Advantage of Merkle Tree:
Merkle tree is an effective way to store the entire data in cryptographic hashed format as the root hash can be used as an input(along with other inputs) to calculate the hash of entire block instead of the data(list of transaction) itself thus encouraging the system to use fewer resources.
Suppose someone tempers a transaction in the block, it would result in different hash for the data which will eventually change the Merkle root. This makes very simple to validate/invalidate a transaction and system more secure.
A Merkle Tree is a tree where every leaf node is hash of data block and every non leaf node is a cryptographic hash of its children. Following diagram demonstrate the structure of the Merkle Tree:

Above diagram is an example of binary Merkle tree but the data structure is not restricted and it is possible to have n-nary Merkle tree as well. There have been extensive use of this data structure in blockchain technology especially in Bitcoin and Ethereum.
How it is used in Bitcoin:
Every transaction that happens on Bitcoin network is stored in blocks. These data blocks contain multiple transactions and each transaction is eventually hashed. Every two hashed values are again hashed together and stored in its parent node. The root of the tree also known as Merkle Root stores the hash based on all transaction in block.
This merkle root of the block is stored in the block header and used as one of the input parameters to calculate the hash of entire block.
Advantage of Merkle Tree:
Merkle tree is an effective way to store the entire data in cryptographic hashed format as the root hash can be used as an input(along with other inputs) to calculate the hash of entire block instead of the data(list of transaction) itself thus encouraging the system to use fewer resources.
Suppose someone tempers a transaction in the block, it would result in different hash for the data which will eventually change the Merkle root. This makes very simple to validate/invalidate a transaction and system more secure.
Comments
Post a Comment