This was found when I recently studied a paper. I did not know what it was, so I checked some information.
What is Merkle tree?
Merkle tree is a tree, most of which is called Merkle hash tree on the Internet. This is because all the Merkle tree nodes it constructs are hash values.
Merkle tree has the following features:
1. It is a tree. It can be a binary tree or a multi-Cross Tree. No matter how many cross trees are, it has all the features of the tree structure;
2. You specify the value of the Merkle tree leaf node. This mainly depends on your design. For example, Merkle hash tree uses the hash value of data as the value of the leaf node;
3. The value of a non-leaf node is obtained based on the values of all the leaf nodes under it and calculated according to certain algorithms. For example, the non-leaf node value calculation method of Merkle hash tree
Is to combine all the child nodes of the node, and then calculate the hash value of the combined result.
For example, if it is a Merkle hash tree, the hash value of node 7 must be calculated by the values of nodes 15 and 16.
Why use Merkle hash tree?
Currently, in the computer field, most Merkle trees are used for comparison and verification. In application scenarios that process comparison or verification, especially in distributed environments,
Merkle tree greatly reduces the data transmission volume and computing complexity. For example, let's take Figure 1 as an example. For example, if the value of 15, 16,... and 30 is the hash value of each data block, I pass the data from
After the data is transmitted to B, I want to verify the validity of the data (whether the data received in B is exactly the same as the data in a), just verify, root of the Merkle tree constructed on B
If the values of the nodes are consistent, the data is valid and remains unchanged during transmission. It is easy to add the corresponding value of 15 during transmission to be tampered.
Locate the node by using the Merkle tree because the values of nodes, and 15 have all changed, and the time complexity of the positioning is O (log (n )).