Merkle trees

Merkle trees

A Merkle tree is a binary tree of cryptographic hash pointers, hence it is a binary hash tree. In the Lither chain, the Merkle trees are constructed by hashing paired data, particularly the transactions at the leaf level, then again hashing the hashed outputs all the way up to the root node, called the Merkle root.

In the Lither chain, there are three Merkle roots in total as follows:

  • stateRoot: It helps maintain the global state.

  • transactionsRoot: It tracks and ensures the integrity of all the transactions in a block.

  • receiptsRoot: It is the root hash of the receipts trie corresponding to the transactions in a block.

The Merkle tree is tamper-proof. Merkle tree is hashed in with other metadata and included in the header of the subsequent block. Tampering at any level in the tree would not match with the hash stored at one level up in the hierarchy, and also till the root node. It becomes impossible for an adversary to change all the hashes in the entire tree. Thus it guarantees the integrity of the order of transactions.

Last updated