What Is Merkle Tree? Complete Guide For Beginners

A Merkle tree (hash tree) is an important part of blockchain technology. It is a structure allowing the secure verification of content. Bitcoin (BTC) and Ethereum (ETH) are the cryptocurrencies using the concept of the Merkle tree. Other applications like Git uses the Merkle tree. While other protocols like a communication protocol called BitTorrent also uses the Merkle tree. The name of the Merkle tree is obtained from a computer scientist named Ralph C. Merkle. The concept of the Merkle tree was patented by Ralph C. Merkle in the year 1979. 

  • Working Of Merkle Tree

A Merkle tree is defined as a generalization of the hash list. In a Merkle tree, a leaf node is defined as a hash of a transaction or transactions while a non-leaf node is defined as a hash of its child nodes. A hash is a value obtained from a hash function. 

Actually, a Merkle tree produces a digital fingerprint of transactions of a block. Nodes will verify the transactions. 

The requirement of a Merkle tree is that an even number of leaf nodes should be there. An odd number of leaf nodes occurs due to an odd number of transactions. If an odd number of leaf nodes occurs, then an even number of the leaf nodes is created by duplicating the last hash. 

There are four transactions like transaction A, transaction B, transaction C, and transaction D in a block. All these four transactions will be hashed to form leaf nodes called Hash A, Hash B, Hash C, and, Hash D. The leaf nodes Hash A and Hash B will be hashed again to form a leaf node called Hash AB, while the leaf nodes Hash C and Hash D will be hashed again to form a leaf node called CD. The leaf nodes Hash AB and Hash CD will be hashed to form a Merkle root or hash root called Hash ABCD. SHA-2 cryptographic hash function is used to perform hashing. 

The Merkle root Hash ABCD will be stored in a block header. The main purpose of the Merkle tree is to maintain the integrity of the data. The Merkle Root will be changed due to the slight change in any of the transactions.

  • More About Merkle Tree

      1. The Merkle tree resides locally. It can’t just reside locally, but it can also reside on a distributed system

      2. A little memory or disk space is required by the Merkle tree because its proofs can be computed easily and quickly. The requirement of proofs and management of the Merkle tree is the transmission of very small amounts of information in a network

    3. A log from an earlier version to its later version can be verified using the Merkle tree. All data will be recorded and presented chronologically. There should be an ability for proving that a log is consistent in the concept of blockchain technology

  • Previous records have not altered or tampered
  • No branches or forks of a log

These two things can prove that a log is consistent

 4. Nodes can benefit from Merkle trees on the blockchain. When a miner receives transactions of a block, then he will be able to calculate a hash progressively in order to add the block. 

  • Simplified Payment Verification (SPV)

Simplified Payment Verification (SPV) is a method used for the verification of transactions. SVP nodes verify whether particular transactions are included in a block or not, but they will not download the entire block. Only a block header is downloaded by them. SPV nodes use the Merkle trees extensively.  

Post Disclaimer

This article is for informational purposes only. The information is provided by What Is Merkle Tree? Complete Guide For Beginners and while we endeavor to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. It is not an offer or solicitation of an offer to buy or sell, or a recommendation, endorsement, or sponsorship of any products, services, or companies. The Blockchain Cafe does not provide investment, tax, legal, or accounting advice. Neither the company nor the author is responsible, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any content, goods or services mentioned in this article.

Show More

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button