← GlossaryMining
What Is a Merkle Tree? How Blocks Summarise Transactions
A Merkle tree is a structure in which items are hashed in pairs, then those hashes are paired and hashed again, until one root hash remains that commits to every item beneath it.
Key takeaways
- Every transaction is hashed, then pairs of hashes are hashed together until one merkle root remains.
- The root goes in the block header, so changing any transaction changes the header.
- A short branch of hashes proves a transaction is in a block without downloading the whole block.
- This is how light wallets verify payments cheaply.
How the tree is built
Start with the list of transaction IDs in a block. Pair them up, concatenate each pair and hash it with the hash function. That produces a second row about half as long. Repeat with that row, pairing and hashing, until there is a single hash left: the merkle root. If a level has an odd number of hashes, the last one is paired with itself. In Bitcoin the developer documentation describes each pair being hashed with double SHA-256.
What the root buys you
The root sits in the block header, so it commits to every transaction at once. Alter any transaction, even a single bit, and its hash changes, which changes every hash above it, which changes the root and therefore the header and the block hash. Nobody can swap a transaction without redoing the proof of work.
Proving a payment with a short branch
A merkle proof shows a transaction belongs to a block using only the hashes along its path to the root, roughly one per level. For a block of thousands of transactions that is a few dozen hashes instead of the whole block. The original Bitcoin paper describes this as simplified payment verification: a light client keeps block headers and asks a full node for the branch linking a transaction to a header's root.
Saving space
The paper also uses the tree to explain how old blocks can be pruned. Spent transactions can be discarded and only the hashes needed to keep the root verifiable are kept, so the header stays valid while storage shrinks.
Example
A block has four transactions A, B, C and D. Hash each, then compute H(AB) = hash(hash A + hash B) and H(CD) = hash(hash C + hash D), then the root = hash(H(AB) + H(CD)). To prove C is in the block you only need hash D and H(AB).
Formula Root = hash( hash(A+B) + hash(C+D) )
Put it into practice
Verify what you receive
Light wallets rely on merkle proofs to confirm payments. Scrypt Wallet lets you hold coins with keys you control and check any transaction in a block explorer.
Create a free wallet Get Scrypt for AndroidSources and verification
Last reviewed 2026-10-02 by the Scrypt Wallet team. The factual claims on this page, and where each comes from:
- Bitcoin pairs transaction IDs and hashes each pair with SHA256(SHA256()) to form the next row, up to the merkle root. [1]
- The paper describes verifying a payment with a merkle branch and header, and pruning old blocks using the tree. [2]
- A Merkle tree hashes items in pairs repeatedly until a single root hash remains. [3]
Sources
- Bitcoin developer reference: Block chain · Bitcoin.org · primary source
- Bitcoin: A Peer-to-Peer Electronic Cash System · Satoshi Nakamoto, 2008 · primary source
- Merkle tree · Wikipedia · secondary source
Primary sources are protocol papers, specifications, source code or a project's own documentation; secondary sources are wikis and explainers. We checked each claim against the source text on the review date. Found an error? Tell us and we will correct it.
Frequently asked questions
Why not just hash all transactions together?
A single hash proves nothing about individual transactions without all of them. A tree lets you prove one transaction with a short path.
Is the merkle root secret?
No. It is public in every block header; it commits to the transactions without revealing more than their hashes.
Do all blockchains use Merkle trees?
Bitcoin and its derivatives do, and so do many others. Ethereum uses a related structure, a Merkle-Patricia trie, for its state.
Written by the Scrypt Wallet team · Updated 2026-10-02. General education, not financial, tax or legal advice.