Table of Contents
In Blockchain, it is very important to keep our transaction and other data encrypted and secure. The security of data is not a new requirement and there is a whole different department working 365 x 24 for the same. This department is the department of cryptography. Under cryptography, a tree is an organization of data in form nodes and leaves as shown below. Since, it resembles a real life tree, that’s why it is named so. In this article we will explore more about tree and one of its important type i.e. Merkle tree.
What is a Cryptography Tree
A Tree in Cryptographic world is a graphical structure which looks like upside down of a real tree with following features:
- Root is at the top
- Elements are known as nodes
- Lines connecting elements are known as branches
- Nodes without any further children are known as leaves
The above points can be also seen in the image shown below:
Here, Subject is the root. Science and English are the nodes. Physics, Chemistry, Biology, Grammar and Literature are the leaves. The line connecting all of them are the branches.
What is a Merkle Tree
A Merkle Tree, also known as Hash Tree, is a cryptographic tree in which every leaf node contains hash value of a data block, while the non-leaf nodes contains hash of child nodes. Thus the root of the tree is actually the hash of all of its child nodes. This concept was given by Ralph Merkle, hence named so.
Merkle Tree in Blockchain
As discussed above, A Merkle tree in a blockchain is also a representation of blockchain data (in our case hash key of the transaction data) in a form of leaf and child node. All the nodes are ultimately connected to a single root. The root is the representation of all the transaction data stored in the nodes as hash keys into a single hash key. Let us make it simple, a Merkle tree is there with multiple branches and each branch has its own branch. Now the last level of branches will have the transactional data in form of hash keys. These hashed keys will be put into pairs and will be hashed again, as shown in the image below. This process gets repeated until we get only one hash. This hash is then stored in the Blockchain as Data and using it only other data can be retrieved or searched. This high level of hashing makes it tamper proof.
- It makes Blockchain Tamper proof
- It makes the blockchain light in terms of space requirement, hence it makes the blockchain fast and light
- It helps to verify the information of a blockchain