ELI5 What is a Merkle Root?

ELI5 What is a Merkle Root?
on September 30, 2019

If you’ve been around cryptocurrencies for a while then you’ve probably heard the term Merkle root thrown around in technical discussions.  Welcome to our ELI5 article on merkle roots and why this concept is important in guarding the integrity of cryptocurrencies’ blockchains.

Before discussing what Merkle root means, let’s take a quick ELI5-level look at Merkle Trees.

Merkle Trees

A Merkle Tree is illustrated at the top of this article.

Suppose your boss walks up to you and says these are your requirements: you’ve got data that cannot change and if any of the data changes, the change should be immediately noticed by everyone.

To achieve this, you can build a binary tree out of the data somehow (order it into pairs and build a tree with lexicographic order, for instance) and then compute hashes for all leaves. Then hash pairs of nodes in the tree and attribute the pair hash to the parent node.

This is an immutable structure because the slightest change on any of the leaves would immediately propagate upwards towards the….

…Merkle Root!

A tree data structure has necessarily one, and only one, root.

So if you hash your way up from the leaves to the root, you’ll end up with one root cryptographic hash which represents the integrity of all the data contained in the tree!

How is this used in Bitcoin Core, you might ask?

Each transaction in a Bitcoin blockchain block has a hash. In fact Bitcoin TX’s are publicly identified by their hash.

We know that the Tx hash is universally unique. At least in the past 10 years nobody has found a TX hash collision. If we organize a Bitcoin block into a tree of pairs of Tx’s and hash their hashes together, we’ll end up with a root hash that is absolutely unique. And if a block were to be changed or even moved within the tree, the root would change completely.

Bitcoin Core and other cryptocurrency implementations use this to verify blocks. A block can be uniquely identified by its Merkle Root hash because the hash of Tx hashes is guaranteed to be unique.

Conclusion

Merkle trees are widely used in cryptographic software to generate unique identifiers for sets of data.

A Merkle Root is the resulting hashing computation on a Merkle Tree.

Merkle Roots are impossible to tamper with and uniquely identify Bitcoin blocks on the blockchain. Bitcoin consensus and validation depend heavily on this concept.

 

–==–

Featured Image: Merkle Tree at Wikipedia / Wikimedia Commons