MERKLE : The unsung hero of decentralization
The media has extensively glorified Satoshi Nakamoto , Vitalik Buterin and Gavin Wood, and there is nothing wrong as these individuals are the enablers of decentralization to the masses, but in the process we all forget to accredit the individuals behind innovation like the ledger systems, cryptography that forms the fundamental building blocks for the decentralized internet we all enjoy today.
Introduction
In this post I would like to introduce cryptographer Ralph Merkle and he's work the Merkle Trees that powers Bitcoin ,Ethereum and other blockchains as well.
What is a merkle tree ?
Merkle tree is a hash based data structure in the from of a tree that is used for data verification and synchronization. It was founded in 1979 and gained it's practical use case with the rise of the internet.
Hashing
Before we dive deep into Merkle tree we need to first understand what hashing is. Hashing is the process of converting an input (an Input can be data such as a document or text ) into fixed size text using a mathematical algorithm called hash function. This fixed size text is the output and is called Hash value. No hash value can ever be the same.
Illustration of hashing
Merkle tree and How it works
Merkle tree is a structure of hash values as illustrated in the image below. It starts with a data block which acts as the input. Here is a detailed step by step explanation
Step 1
Data block 1 is hashed to Hash value 1 , ( It is also called Child 1)
Data block 2 is hashed to Hash value 2 , ( Child 2)
Data block 3 is hashed to Hash value 3 , ( Child 3)
Data block 4 is hashed to Hash value 4 . ( Child 4)
Step 2
Hash value 1 and Hash value 2 are hashed to create Hash value 5 (also called Parent)
Hash value 3 and Hash value 4 are hashed to create Hash value 6 (Parent)
Step 3
Hash value 5 and hash value 6 are hashed to create hash value 7.
The obtain hash value 7 is called Root hash
The root hash is the main hash and contains the details of all the concatenate hash values( ie Parents and Children). Using the Root hash value along with a few concatenated Parent or children hash value we can verify all the data blocks.
Application of the Merkle Tree
Torrent is a peer to peer file transfer service. It is designed to be an anonymous network of users sharing files to each other, so how do you trust someone sending files to you on this network ?
Answer. Merkle trees
As explained above the files are split into small pieces similar to data blocks. When you download the torrent file or Magnet link you are essentially downloading the Root hash value from a trusted source.
Once you have the root hash value you can then download its parents (hash value 5, hash value 6 ) and children (Hash value 1,2,3,4) from unknown users of the network. We can then verify that if these downloaded Hashes Values are correct by concatenating them and confirming that it is equal to our root hash we obtained from the trusted source. The process is repeated until the entire Merkle tree downloaded from the network.
Writing too much data onto the block chain is very expensive and is considered inefficient. Using a merkle tree thousands of transaction can be coupled into one single string called a root hash. This root hash value is then written onto the chain And by using the root hash value and a short proof one can confirm the authenticity and details of the transaction on the chain. This entire process is called a merkle commitment.
Example of Chains running the merkle commitments are Bitcoin and Ethereum.
Conclusion
Just like Ralph there are plenty of geniuses out there who have contributed immensely and are the silent heroes of the decentralized world. And we should all give the credit where due. In the coming few weeks I shall be covering some of them.
Feel free to comment down below your thoughts and questions.
If you made it till here you might as well want to check out my other post
The expectation of constructing realistic expectations
Our Pursuit Of Unhealthy Happiness
TL;DR
- Ralph Merkle founded Merkle trees.
Merkle tree is a hash based data structure in the from of a tree structure . - Hashing is process assigning a unique id (hash value) to a piece of data. Data here is the input and can be a document, image or a transaction. The output obtained here is called hash value .No hash value can ever be the same
- Hashed value are then concatenated with other hashed value to produce a new hash value. This forms a merkle tree
- Merkle trees are used in Torrent network and most block chain networks