What is Merkle tree?

What is Merkle tree?

A blockchain is made up of several blocks that are connected to each other. Each block contains several transactions and hashes of it. All transaction hashes end up at the merkle tree. A Merkle tree or “binary hash tree”, is one of the “security personals' ' of a blockchain. This tree encodes the data of a blockchain more securely and with enhanced efficiency. In a merkle tree, Every node (leaf) is labelled with a cryptographic hash of a data block. Every node that is not a leaf (called branch) is labelled with the hash of its child nodes (leafs).

It supports quick verification and movement of huge amounts of data from one node to another on a blockchain network. Every transaction on a blockchain network has its own hash. These hashes are not stored in sequential order. They are stored in the form of a tree-like structure. As there are a number of transactions stored in each block, all the transaction hashes of that block are also hashed. This forms a tree-root-like structure called merkle root.

At the leaf level (lowest level), there will be 4 transaction hashes. At one level above this, there will be two transaction hashes hashed again. These will connect those hashes at leaf level. At the top most level, there will be one more hash. This hash will connect the hashes below it and is called merkle root.

In other words, you will get an inverted binary tree. Each node on this tree will connect to two nodes located below it. The hash on top is called “root hash”. The size of this structure varies with the amount of transaction hashes.

The hashing always starts at the leaf level (lowest level). If the hashing starts at level one it will continue reaching higher levels. This continues till it reaches the root hash.?

This root hash is the merkle root. Merkle root contains all the information about transaction hashes connected to it. By doing this, merkle root offers a single hash value that enables validating all the data of that block.

Say you are a validator node & want to verify block number #2, without disturbing block #1 or #3. All you have to do is to get the merkle root of that block. As it carries all the information of the entire tree, it will speed up the verification. You can easily verify whether a transaction is valid or not by verifying the transaction hash. You can also achieve it by verifying the node connected to it (sibling-node) and moving upwards till you reach the top.?

The mechanism of merkle tree and merkle root significantly decrease the level of hashing performed. They allow quick verification and thus increase the speed of transactions by large margins.

RNS Solutions Research Lab is continuously doing research in blockchain technology, its architecture and usage. The aim behind this research is to bring betterment in the blockchain world. RNS solutions Research Lab remains in collaboration with RNS solutions development lab to bring innovation in this domain.?These days BLS signatures are popular because of their aggregation properties. We will cover BLS signatures in one of our upcoming articles.

要查看或添加评论,请登录

Genesis IT Lab的更多文章

社区洞察

其他会员也浏览了