An overview of what Merkle tree is in blockchain.

An overview  of what Merkle tree is in blockchain.

An overview of what Merkle tree is in blockchain(2).png

Introduction

In a blockchain system a block might contain 6-7 number of transactions each having different hash value , how do we create a single hash value that will represent all other transactions inside the block and serve as the hash value for the block.

In blockchain the solution to this puzzle is solved by a concept refers to as Merkle tree

What is a Merkle tree ?

It is a data structure which involves the hashing of paired transactions to generate a single hash value for the 2 transactions. It is used in blockchain to generate the hash of a block with more than one transactions. It was invented by Ralph Merkle in 1988 in attempt to develop a better digital signature. The pairing is in the form of a tree with the root at the top and the leaves at the bottom forming branches to the top to create a structure that makes transaction verification easy and tampering resistant. The root at the top is the hash value of the block while the leaves are the hash value of transactions inside the block.

How a Merkle tree works

In an instance, a block contains 7 transactions ,to generate a single hash value for the block using Merkle tree, each of them will be paired with the next one close to it. The paired transactions are then hashed together to generate a single hash value. The hashing then continues till we are left with a single hash value that will represent the block.

Like this 1 2 3 4 5 6 7 = 1&2, 3&4, 5&6, 7 what happen to this one ?

In a case where the number of transaction is even then pairing is quiet easy, as for an odd number of transactions the the last one is repeated and then paired

like this

1.png

Graphical illustration of a Merkle tree

This is an illustration of what Merkle tree looks like ........

An-example-of-Merkle-Tree.jpg

Conclusion

So this is just an overview on what Merkle tree is and how they are use in blockchain. I hope you enjoy reading through the article.

I'm Eibrahim , i create content that explain the basics and core concept of web 3 and blockchain

you can follow me on

Twitter

Hashnode

for more fresh contents on web 3.