Merkle Tree in BlockChain
Yongchang He
Posted on March 10, 2022
Basic knowledge of BlockChain
The purpose of building this blog is to write down the detailed operation history and my memo for learning the dApps and BlockChain.
If you are also interested and want to get hands dirty, just follow me and have fun!~
Related Blogs
Learning BlockChain? Here are the things you want to go through
Table of Contents
- What is Merkle Tree in BlockChain?
- What is a Hash function?
- How does Merkle Tree work?
- What are the benefits of Merkle Tree?
What is Merkle Tree in BlockChain?
Merkle tree, also known as a hash tree, is a tree in which each leaf node is labeled with the cryptographic hash of a data block, and each non-leaf node is labeled with the cryptographic hash of its child nodes' labels. The majority of hash tree implementations are binary (each node has two child nodes), but they can also have many more child nodes.
The top hash is known as Merkle Root. They're used in blockchain structure to ensure that data blocks sent through a peer-to-peer network are whole, undamaged, and unaltered.
What is a Hash function?
A hash function maps any type of arbitrary data of any length to a fixed-size output. They are efficient and are well-known for one property: they are irreversible. Some of the Hash families available are Message Direct (MD), Secure Hash Function (SHF), and RIPE Message Direct (RIPEMD).
You can play games yourself with a Hash function known as SHA256. For example, you can input an arbitrary length of data as input, whereas you should always get a fixed-size output.
How does Merkle Tree work?
A Merkle tree totals all transactions in a block and generates a digital fingerprint (Merkle Root) of the entire set of operations, allowing the user to verify whether it includes a transaction in the block. Merkle trees are made by hashing pairs of nodes repeatedly until only hash root/Merkle root hash remains. They're built from the bottom, using Transaction IDs, which are hashes of individual transactions. Each non-leaf node is a hash of its previous hash, and every leaf node is a hash of transactional data.
What are the benefits of Merkle Tree?
Let's summarize the benefits of Merkle Tree using in blockchain structure:
- It can be effectively used to validate the integrity of the data.
- It takes little disk space compared to other data structures.
- It can be divided into tiny pieces of information for verification.
- It is efficient and takes only a while to verify the integrity of the data.
Reference
https://www.simplilearn.com/tutorials/blockchain-tutorial/merkle-tree-in-blockchain
https://emn178.github.io/online-tools/sha256.html
https://101blockchains.com/merkle-trees/
https://kryptomoney.com/bitcoin-blockchain-vr-virtual-reality-3d/
Posted on March 10, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.