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.
- Cryptocurrencies in Islam: Halal or Haram?
- Platforms for issuing tokens: Where to mint coins for ICOs?
- Hybrid cryptocurrency exchanges: what is HEX?
- What is cryptojacking and how to escape from it?
- How to Know Mining: Key Terms
- The best software miners for a quick start
- Creating a blockchain with your own hands in Python
- What are parachains?
- What is NFT?
- What is Bitcoin?
- How to assemble a rig for mining with your own hands