Merkle Tree Explained

Cryptocurrency Unlimited Mining

THE RISE OF CRYPTOCURRENCY – THE MERKLE TREE EXPLAINED 

CRYPTOCURRENCY UNLIMITED MINING

LEADING & QUALIFIED BLOCKCHAIN ENGINEER
DAVID GAWLER

A Merkle tree is a hash-based data structure that is a generalization of the hash list. It is a tree structure in which each leaf node is a hash of a block of data, and each non-leaf node is a hash of its children. Typically, Merkle trees have a branching factor of 2, meaning that each node has up to 2 children.

Merkle trees are used in distributed systems for efficient data verification. They are efficient because they use hashes instead of full files. Hashes are ways of encoding files that are much smaller than the actual file itself. Currently, their main uses are in peer-to-peer networks such as Tor, Bitcoin, and Git.

Merkle trees are typically implemented as binary trees, as shown in the following image. However, a Merkle tree can be created as an nn-nary tree, with nn children per node.

In this image, we see an input of data broken up into blocks labeled L1 though L4. Each of these blocks are hashed using some hash function. Then each pair of nodes are recursively hashed until we reach the root node, which is a hash of all nodes below it.

Benefits and Protocol
In various distributed and peer-to-peer systems, data verification is very important. This is because the same data exists in multiple locations. So, if a piece of data is changed in one location, it’s important that data is changed everywhere. Data verification is used to make sure data is the same everywhere.

However, it is time-consuming and computationally expensive to check the entirety of each file whenever a system wants to verify data. So, this is why Merkle trees are used. Basically, we want to limit the amount of data being sent over a network (like the Internet) as much as possible. So, instead of sending an entire file over the network, we just send a hash of the file to see if it matches. The protocol goes like this:

Computer A sends a hash of the file to computer B.
Computer B checks that hash against the root of the Merkle tree.
If there is no difference, we’re done! Otherwise, go to step 4.
If there is a difference in a single hash, computer B will request the roots of the two subtrees of that hash.
Computer A creates the necessary hashes and sends them back to computer B.
Repeat steps 4 and 5 until you’ve found the data blocks(s) that are inconsistent. It’s possible to find more than one data block that is wrong because there might be more than one error in the data.

Note that each time a hash is found to match, we need nn more comparisons at the next level, where nn is the branching factor of the tree.

This algorithm is predicated on the assumption that network I/O takes longer than local I/O to perform hashes. This is especially true because computers can run in parallel, calculating multiple hashes at once.

Because the computers are only sending hashes over the network (not the entire file), this process can go very quickly. Plus, if an inconsistent piece of data is found, it’s much easier to insert a small chunk of fixed data than to completely rewrite the entire file to fix the issue.

The reason that Merkle trees are useful in distributed systems is that it is inefficient to check the entirety of file to check for issues. The reason that Merkle trees are useful in peer-to-peer systems is that they help you verify information, even if some of it come from an untrusted source (which is a concern in peer-to-peer systems).

The way that Merkle trees can be helpful in a peer-to-peer system has to do with trust. Before you download a file from a peer-to-peer source—like Tor—the root hash is obtained from a trusted source. After that, you can obtain lower nodes of the Merkle tree from untrusted peers. All of these nodes exist in the same tree-like structure described above, and they all are partial representations of the same data. The nodes from untrusted sources are checked against the trusted hash. If they match the trusted source (meaning they fit into the same Merkle tree), they are accepted and the process continues. If they are no good, they are discarded and searched for again from a different source.

Use Cases

Benefits and Protocol
In various distributed and peer-to-peer systems, data verification is very important. This is because the same data exists in multiple locations. So, if a piece of data is changed in one location, it’s important that data is changed everywhere. Data verification is used to make sure data is the same everywhere.

However, it is time-consuming and computationally expensive to check the entirety of each file whenever a system wants to verify data. So, this is why Merkle trees are used. Basically, we want to limit the amount of data being sent over a network (like the Internet) as much as possible. So, instead of sending an entire file over the network, we just send a hash of the file to see if it matches. The protocol goes like this:

Computer A sends a hash of the file to computer B.
Computer B checks that hash against the root of the Merkle tree.
If there is no difference, we’re done! Otherwise, go to step 4.
If there is a difference in a single hash, computer B will request the roots of the two subtrees of that hash.
Computer A creates the necessary hashes and sends them back to computer B.
Repeat steps 4 and 5 until you’ve found the data blocks(s) that are inconsistent. It’s possible to find more than one data block that is wrong because there might be more than one error in the data.
Note that each time a hash is found to match, we need nn more comparisons at the next level, where nn is the branching factor of the tree.

This algorithm is predicated on the assumption that network I/O takes longer than local I/O to perform hashes. This is especially true because computers can run in parallel, calculating multiple hashes at once.

Because the computers are only sending hashes over the network (not the entire file), this process can go very quickly. Plus, if an inconsistent piece of data is found, it’s much easier to insert a small chunk of fixed data than to completely rewrite the entire file to fix the issue.

The reason that Merkle trees are useful in distributed systems is that it is inefficient to check the entirety of file to check for issues. The reason that Merkle trees are useful in peer-to-peer systems is that they help you verify information, even if some of it come from an untrusted source (which is a concern in peer-to-peer systems).

The way that Merkle trees can be helpful in a peer-to-peer system has to do with trust. Before you download a file from a peer-to-peer source—like Tor—the root hash is obtained from a trusted source. After that, you can obtain lower nodes of the Merkle tree from untrusted peers. All of these nodes exist in the same tree-like structure described above, and they all are partial representations of the same data. The nodes from untrusted sources are checked against the trusted hash. If they match the trusted source (meaning they fit into the same Merkle tree), they are accepted and the process continues. If they are no good, they are discarded and searched for again from a different source.

Use Cases

Merkle trees have very little overhead when compared with hash lists. Binary Merkle trees, like the one pictured above, operate similarly to binary search trees in that their depth is bounded by their branching factor, 2. Included below is worst-case analysis for a Merkle tree with a branching factor of k.

Average Worst
Space O(n) O(n)
Search O\big(\log_2(n)\big) O\big(\log_k(n)\big)
Traversal *O(n) *O(n)
Insert O\big(\log_2(n)\big) O\big(\log_k(n)\big)
Delete O\big(\log_2(n)\big) O\big(\log_k(n)\big)

*Amortized

However, a very important aspect of Merkle trees (and their biggest use case) is in the synchronization of data. In the typical case, this synchronization will be a \log_2(n) operation because it is based on traversal and search. However, there is a worst-case situation where there are no nodes in common. In this scenario, synchronization is akin to making a complete copy of the file, which will be a O(n) operation.

Cryptocurrency Unlimited Bitcoin Mining. Bitcoin uses the merkle tree by design.

Come again? What is the markle tree.  So in bitcoin mining, we got the blockhain so that transactions can be verified by the proof of work mechanism to verify individual financial transactions. You can imagine how useful the merkle tree by design is helpful to verify transactions in the bitcoin that utilises the blockchain ledger system to successfully verify transactions.  Every single is not OK with the transaction until every single computer that’s decentralised in the blockchain mining process is confirmed as OK as a verified transaction. Specialised cryptocurrency unlimited hardware mining equipment that achieves this. Especially build super computers for cryptocurrency unlimited mining uses GPU miners or ASIC miners to verify the merkle tree when verifying transactions for the merkle tree, bitcoin blockchain.

Merkle Trees solve this problem. They hash the records in the ledger, which effectively separates the proof of data from the data itself. Proving a transaction is valid only involves sending small amounts of information across the network.

One of the most common questions cryptocurrency unlimited mining gets asked well if bitcoin uses the merkle tree by design for proof of work (PoW).

A Merkle tree is a data structure that is used for secure verification of data in a large content pool. It is also efficient and consistent when it comes to verifying the data. Ethereum and Bitcoin both utilize Merkle Trees. 

It’s is because by design. The merkle tree is used to verify decentralised transactions across the world.  Without the merkle tree, BItcoin, Ethereum POW (proof of work) algorithms would not exis nor work as decantralisation efforts.  Merkle Tree is fundamentally the most important concept to understand when it comes to decentralisation, the blockchain, bitcoin, ethereum.

Algorithms like the ERGO cryptocurrency unlimited mining we mine for cryptocurrency autolykos2 uses an enhanced version of the merkle tree. But, ultimately The merkle tree concept applies to all PoW decentralisation minin/cryptocurrencys.

LEADING & QUALIFIED BLOCKCHAIN ENGINEER
DAVID GAWLER