Merkle Tree / Merkle Root
DeFiA Merkle tree is a data structure used in blockchains to efficiently and securely summarize a large set of transactions.
A Merkle tree is a data structure used in blockchains to efficiently and securely summarize a large set of transactions. Named after computer scientist Ralph Merkle, the structure works by repeatedly hashing pairs of data together until you arrive at a single hash at the top, called the Merkle root. Every block in Bitcoin and Ethereum contains a Merkle root in its header — a short string that acts as a tamper-proof fingerprint for all the transactions in that block.
Imagine you have eight transactions in a block. Each is hashed individually to produce eight “leaf” hashes. Those eight are paired and hashed together to produce four hashes, which are paired to produce two, then hashed to produce the single Merkle root. Because each hash depends on the data below it, changing even a single character in any transaction would completely change the final Merkle root — anyone can immediately detect tampering. This structure also enables Merkle proofs, which allow a lightweight device like a phone to verify a specific transaction was included in a block without downloading the entire block.
Example: Think of a Merkle tree like a recipe book with a unique code on the cover. Each recipe has its own code. Those codes are combined in pairs to create section codes, which combine to create the single cover code. Change one ingredient in one recipe and the cover code changes completely — anyone can detect tampering just by checking that one code.