What is Merkle Tree and how are they used in cryptocurrencies?

What is Merkle Tree and how are they used in cryptocurrencies?

04.02.2023
Author: Robert Strickland
Subscribe

What is Merkle Tree and how are they used in cryptocurrencies?


In various articles on cryptocurrencies, you can meet such a definition as the Merkle tree. Especially often this concept is glimpsed in WhitePaper ICOs. In this article, we will try to explain in an accessible way what the Merkle tree is and why it is so important for digital currencies.

  • WHAT IS A MERKLE TREE?

The Merkle tree is one of the varieties of hash functions that allow transforming any array of data into a string of a specific size. Simply put, the process takes some data as input, which is then transformed into a string of digits of binary code. This set of digits is always unique and not repeated for different input data.

The Merkle tree is often called a hash tree. It is characterized by the following features:

Using the Merkle tree, it is possible to assign a unique identifier to any document.
The Merkle tree is able to participate in checking the integrity of digital documents.
With the help of such a hash function, it is possible to recover lost files.
The hash tree has been known for quite some time. It was developed by Ralph Merkle back in 1979. If we talk about its structure, it actually resembles a tree. In the final nodes are hidden hashes of blocks of data themselves.

If we consider this algorithm in a more understandable way, it works as follows:

A large amount of data (Data block 1 to Data block 4) comes into the system.
From each cluster of data, hashes are formed, which are then hashed again.
The re-hashing continues until there is only one hash value left in the system - the Merkle root.


Thus, it is possible to transform as much of a given hash as you want by reducing it to a single hash.

  • HASH TREE AND BITCOIN

Usually, hash trees are used in filesystems to check data for errors, but in bitcoin, they are used to enable simplified payment verification (SPV). Clients that use such a feature are called light clients - they only store block headers, not the full contents.

Light clients don't recalculate all hashes to verify transactions; they request only the Merkle proof. It includes the Merkle root and branch, which contain hashes from the transaction itself to the root. This allows you to refer to a specific transaction instead of using the entire amount of transaction information.

Such a mechanism, using the Merkle tree, significantly reduces the load on the network and speeds up the process of execution. For example, 5 translations of the maximum size in total weigh about 500 kilobytes, while the Merkle tree will have a size of not more than 140 kilobytes at the same conditions.

It is worth noting that hash trees are used not only in bitcoin but also in a number of other cryptocurrencies. For example, Ethereum uses Merkle's prefix tree. There are also other similar structures with some peculiarities and adjustments. We will talk about this in another publication.

Other instructions

Cold and hot cryptocurrency wallets. What is the difference and how to create them?
Securing Information: Shamir's Secret Sharing Scheme and Bitcoin
"Reputation Institute. What will happen to blockchain in 30 years
What is Worldcoin? Why the creator of ChatGPT needs a catalog of all the inhabitants of the planet
Measure blockchain. How important is the TVL indicator
What is Lightning Network and how the project solves bitcoin's main problem
Trustpilot