What is a Merkle tree?
- Author
- CRYPTO PORT Editorial
- Published
- Updated
- Reading time
- 5 min
In short
A Merkle tree hashes transactions together in pairs, level by level, until everything collapses into a single value called the Merkle root. That lets you prove a specific transaction is inside a block without downloading the block. It is the reason lightweight phone wallets can verify anything at all.
Key points
- A tree that condenses many transactions into one hash
- Only the Merkle root is stored in the block header
- Membership is proven with a logarithmic number of hashes
- Altering a single transaction always changes the root
Definition
A tree built by hashing data items, then repeatedly hashing them in pairs until a single value remains at the top. That top value is called the Merkle root.
A Bitcoin block can hold thousands of transactions. Each is hashed, adjacent hashes are concatenated and hashed again, and the process repeats upward until one value is left. That value — the Merkle root — is the only 32 bytes of transaction data stored in the block header.
To prove a transaction belongs to a block, you only need the sibling hashes along its path to the root. With a thousand transactions that is about ten hashes. A light wallet takes the block header plus this proof and confirms an incoming payment without holding the block itself.
Because of how hash functions behave, changing a single byte of an amount or destination changes every hash above it and therefore the root. The root sits in the header, and each later block references the previous header, so rewriting an old transaction breaks every block that follows.
Watch out for
- · A Merkle proof shows membership in a block, not that the block is on the valid chain — that has to be checked separately
- · Light wallets do not verify every consensus rule, so they cannot validate as independently as a full node