Blockchain Merkle Tree




Blockchain Merkle Tree

  • Merkle tree may be a fundamental a part of blockchain technology. It's a mathematical data structure composed of hashes of various blocks of data, and which is a summary of all the transactions during a block.
  • It also allows for efficient and secure verification of content in a large body of data. It also helps to verify the consistency and content of the data.
  • Both Bitcoin and Ethereum use Merkle Trees structure. Merkle Tree is also named as Hash Tree.
  • The concept of Merkle Tree is named after Ralph Merkle, who patented the thought in 1979.
  • It's a data structure tree in which all leaf node labelled with the hash of a data block, and therefore the non-leaf node labelled with the cryptographic hash of the labels of its child nodes.
  • The leaf nodes are lowest node within the tree.

How do Merkle trees work ?

  • A Merkle tree stores all the transactions in a block by producing a digital fingerprint of the entire set of transactions.It allows the user to verify whether a transaction can be included during a block or not.
  • Merkle trees are created by repeatedly calculating hashing pairs of nodes until there's just one hash left. This hash is named the Merkle Root, or the root Hash. The Merkle Trees are constructed during a bottom-up approach.
  • Every leaf node may be a hash of transactional data, and therefore the non-leaf node may be a hash of its previous hashes.
  • Merkle trees are during a binary tree, so it requires an even number of leaf nodes.
  • If there's an odd number of transactions, the last hash are going to be duplicated once to make an even number of leaf nodes.
 Blockchain Merkle Tree

Blockchain Merkle Tree

  • The above example is that the most common and simple sort of a Merkle tree, i.e., Binary Merkle Tree. There are four transactions during a block: TX1, TX2, TX3, and TX4. There's a top hash which is that the hash of the entire tree, named as the root Hash, or the Merkle Root. Each of those is repeatedly hashed, and stored in each leaf node, leading to Hash 0, 1, 2, and 3. Consecutive pairs of leaf nodes are then summarized during a parent node by hashing Hash0 and Hash1, resulting in Hash01, and separately hashing Hash2 and Hash3, resulting in Hash23. The two hashes (Hash01 and Hash23) are then hashed again to produce the root Hash or the Merkle Root.
  • Merkle Root is stored within the block header. The block header is that the part of the bitcoin block which gets hash within the process of mining. It contains the hash of the last block, a Nonce, and therefore the Root Hash of all the transactions within the current block in a Merkle Tree. Having the Merkle root in block header makes the transaction tamper-proof. As this Root Hash includes the hashes of all the transactions within the block, these transactions may result in saving the disk space.
  • The Merkle Tree maintains the integrity of the data. If any single detail of transactions or order of the transaction's changes, then these changes reflected within the hash of that transaction.
  • This alteration would cascade up the Merkle Tree to the Merkle Root, changing the value of the Merkle root and thus invalidating the block. So everyone can see that Merkle tree allows for a fast and simple test of whether a specific transaction is included within the set or not.

Merkle trees Benefits

  • Their proofs and management require tiny amounts of information to be transmitted across networks.
  • It provides a way to maintain the integrity and validity of data.
  • It helps in saving the memory or disk space as the proofs, computationally easy and fast.


Related Searches to Blockchain Merkle Tree