Merkle Tree
Merkle Tree, also known as Hash Tree, is a data structure which is used for verification and
synchronization of data. A Hash is like a fingerprint, encrypted unique output from an input of data
which is converted using a specific algorithm. Hash is created to increase security for data, As the
data is distributed in the blockchain, it becomes necessary to encrypt the data to provide some sort of
privacy and security.
Merkle Root
For every Transaction, there
is a Hash but a block in
blockchain can have
Branches
thousands of transactions,
and to have a Hash function Leaves
and then sending a block
will be very time consuming
and will require a huge Transactions
amount of space, thus Figure 1: Merkle Tree
Merkle Tree comes into play.
It is a tree data structure where each non-leaf node is a hash of its child nodes.
Every Transaction has their own specific hash, called Leaves, i.e., H a, Hb, Hc etc.
Hash of two transactions is combined using a specific formula according to the algorithm and
converted into a single Hash, called Branches, i.e. H ab=Ha+Hb etc. (if there are odd number of
Hashes, the last one is repeated and combined with itself i.e., H yy=Hy+Hy.
The branches are combined again and again until only one Hash is remaining, called Merkle
Root.
Benefits of Merkle Tree
Reduced Memory Usage: Instead of sending thousands of Hashes of different Transactions,
Using Merkle Tree, there is only need of sending a single Hash, Thus, reducing the data usage
and improve transmission speed.
Simplified Payment Verification (SPV): Instead of downloading a complete block data to
verify the data, it can be easily verified using the Merkle Root and thus simplifying the
process.
Data Integrity and Consistency: It becomes easy to check the integrity and consistency of
data between trusted and untrusted peers.
References
Introduction to Merkle tree. (2020, September 29). GeeksforGeeks.
https://www.geeksforgeeks.org/introduction-to-merkle-tree/
Merkle tree. (n.d.). Brilliant | Learn to think. https://brilliant.org/wiki/merkle-tree/
Understanding hash. (n.d.). Investopedia.
https://www.investopedia.com/terms/h/hash.asp#:~:text=A%20hash%20is%20a
%20function,to%20blockchain%20management%20in%20cryptocurrency
What is a Merkle tree and how does it affect blockchain technology? (2019, November 15).
SelfKey. https://selfkey.org/what-is-a-merkle-tree-and-how-does-it-affect-blockchain-
technology/#:~:text=The%20Benefit%20of%20Merkle%20Trees&text=Merkle%20Trees
%20have%20four%20sizable,to%20be%20transmitted%20across%20networks