Blockchains are massive repositories of data. In these structures where data flows from many different points, data needs to be stored securely and efficiently. A Merkle Tree allows such large data to be stored in summary form.
Each transaction in a block consists of short and unique hashes of all transactions generated through various functions. Every block on the blockchain has a Merkle Root.

Let’s suppose that there are 4 transactions in a block, and they are Transaction A, Transaction B, Transaction C, and Transaction D. Each of these transactions has a unique summary, and these are Hash A, Hash B, Hash C, and Hash D. These transactions come together to form new hashes. Hash A and Hash B come together to form Hash AB. Similarly, Hash C and Hash D come together to form Hash CD. These are, as seen above, are the branches of the Merkle Tree. Hash AB and Hash CD then grouped together to form Hash ABCD, which is the Merkle Root. The Merkle Root is then stored in the block header.
Advantages of the Merkle Tree
- There is a hash consisting of the root of the Merkle Tree within each block. These blocks also have a hash of the previous block. In this way, the blocks on the blockchain can be connected to each other.
- Thanks to these hashes in blocks, when a transaction is to be changed, it is necessary to go back from the root of the entire tree to the branches. Since the slightest alteration changes the entire hash, it also overrides subsequent blocks. Therefore, the hashes generated with the Merkle Tree prevent the blockchains from being altered.
- Blockchains are data stores where data from many parts of the world is stored. There are thousands of blocks holding thousands of transactions, so storing all this data is quite costly. Merkle Trees significantly minimize the amount of data required for validation to solve this problem. Users can verify blocks and check transactions using hashes. This minimizes the computing power required for validation.
