A Merkle tree is a binary tree data structure (meaning that each parent has at most two children nodes), where the leaf nodes contain the hash digests of the data blocks, and parent nodes contain the hash digest calculated on the hashes of its children. The process of hashing terminates when the root of the tree is reached.
Data integrity is guaranteed by the root hash value: if one of the nodes were to be modified, the digest associated with the root would change radically, by virtue of the sensitivity of the hash functions to even the slightest changes in input data.
The Merkle tree is particularly useful in the blockchain as it allows us to store sets of data by calculating a hash digest for each dataset, hence synthesizing all of the transactions contained in each block. The implementation of Bitcoin's Merkle tree uses SHA-256 as a hash function...