Glossary
Merkle tree (Merkle root)
A Merkle tree hashes data in pairs up to a single Merkle root, so anyone can prove one transaction is in a block with only a few hashes.
On this page
A Merkle tree is a way of summarizing many pieces of data with a single short fingerprint. Each item is hashed, then the hashes are paired and hashed again, level by level, until one hash is left: the Merkle root. Change any item and the root changes. Ralph Merkle filed the patent for the idea in 1979, and it was granted in 1982. Every Bitcoin block header carries the Merkle root of the block's transactions.
A hash function turns any input into a fixed-length output that cannot practically be reversed. Bitcoin uses double SHA-256.
Why it matters
The proof grows with the logarithm of the number of items, not the number itself. A block of 4,096 transactions needs 12 hashes, because 2^12 = 4,096. That is what lets a light client, one form of blockchain node, check a payment with block headers alone, the simplified payment verification described in the Bitcoin white paper.
The root also keeps the header small: proof-of-work miners hash the 80-byte header, not the full transaction list.
Details and limits
- Odd numbers. Bitcoin pairs the last hash with a copy of itself when a level has an odd count.
- Proof of inclusion, not validity. A Merkle proof shows a transaction is in a block. It does not show the block follows the rules; that is a full node's job.
- Wider use. Exchanges use Merkle trees in proof-of-reserves reports so each customer can check that their balance was counted.
