in BlockChain by
Q. What is a Merkle Root in BlockChain?

1 Answer

0 votes
by
Before we dive further into this topic, it is important to briefly talk about hashing. Hashing functions are mathematical algorithms that take inputs and generate unique outputs. Some of the most common hashing functions are MD5, SHA-3, and SHA-256 – the last of which is used by Bitcoin. We will come back to hashing in a minute.

As we now know, the single code that a Merkle Tree produces is referred to as a Merkle Root. Each individual block in a blockchain has one. How a Merkle Root is produced is slightly more complicated, but important to understand.

By design, Merkle Trees always group all of the data inputs into pairs. If there happens to be an odd number of inputs, then the last input is copied and paired with itself. This applies to all transaction IDs written onto a block in a blockchain.

Here is an example. Let’s say that a single block contains a total of 424 transactions. The Merkle Tree would start by grouping these transactions into 212 pairs. The next step is for the 212 transaction ID pairs to go through a hashing function. This would result in 212 new 64-character codes.

The process continues. The 212 new codes would be paired up and turned into 106 pairs. The process is repeated again, cutting the number of codes in half each time, until only one code remains. That code is the Merkle Root.

Related questions

0 votes
asked Sep 16, 2019 in BlockChain by john ganales
+2 votes
asked Aug 14, 2019 in BlockChain by rahulsharma
+1 vote
asked Aug 14, 2020 in BlockChain by RShastri
...