Merkle hash trees
A Merkle tree is a binary tree where all the leaf nodes represent hashes of the data blocks. Each parent node has the hashed value of the hashes of its children. Hashing continues until the root node of the tree. Merkle trees are used to summarize bulk sets of data and create a fingerprint for each set.
A Merkle tree is constructed from the bottom up from the leaf nodes. In Figure 2.12, leaf nodes will consist only of hashed values of data blocks A, B, C, and D represented by HA, HB, HC, and HD respectively. Each parent node will construct its hash by concatenating the hash values of the child nodes and hashing them again:
HAB = Hash (HA + HB)
This process is continued until the root node hash value HABCD is calculated.
Merkle trees not only provide a way of summarizing an entire data block, but they can also efficiently verify whether a data block exists. Verification could be achieved in just log2(n) complexity.