BOMBARCHIVE
Explore

A living reference collection. Written in the wiki, preserved in Git.

The archiveBitcoin

Old revision: Merkle tree

OshiB: trace Merkle authentication trees from 1979 patent to Bitcoin commitments

A Merkle tree, also called a hash tree, is a structure for committing to many pieces of data with one root value while allowing a reader to verify an individual piece using a short path of sibling hashes. It is named for Ralph Merkle, whose earlier authentication tree work predates Bitcoin by nearly three decades.

The key distinction is between knowing a root and knowing what its leaves contain. A Merkle proof can connect a claimed leaf to a trusted root. It does not by itself establish that the complete collection is valid, that nothing was omitted, who created a document or when a transaction occurred.

The early record: application in 1979, patent in 1982

The strongest directly inspected origin artifact here is US patent 4,309,569, Method of providing digital signatures. It names Ralph C. Merkle as inventor, records a filing date of 5 September 1979 and an issue date of 5 January 1982. Its text specifies an authentication tree constructed with a one-way function, a root, and an authentication path from an item to that root. Claim 3 covers authenticating an item in a list using such a tree. These are the recognisable ingredients of what is now called a Merkle tree. Patent record, text and claims · NIST Dictionary of Algorithms and Data Structures

This is important chronological housekeeping. 1979 is the patent filing year, not its grant year. Merkle's own bibliography separately lists a 1979 Stanford dissertation, Secrecy, Authentication, and Public Key Systems, and later treatments of digital signatures. That bibliography corroborates the dissertation's existence but does not, without comparison of the complete thesis, prove that every feature of the granted patent appeared unchanged in the dissertation. Merkle's first-party publication list

Merkle was working on authenticating one-time signing keys: many public values could be certified relative to one authenticated root without requiring every verifier to store a separately trusted copy of every key. That original use is different from Bitcoin's later use of transaction identifiers as leaves. The patent also extends its tree method to authenticating an item in a list, so the generality was visible in the early record, not invented retroactively. Original patent description and claims

What a proof actually proves

For four leaves A, B, C and D, a binary version can compute one parent from A and B, another from C and D, then a root from those two parents. Someone who knows the trusted root can verify leaf C using C, D and the hash of the A–B subtree, plus their left/right positions. The number of sibling values rises roughly with the logarithm of the number of leaves rather than requiring the full collection.

        root
       /    \
     H(AB)  H(CD)
     /  \   /  \
     A   B  C   D

The diagram is conceptual: actual systems must define exactly how each value is serialized and hashed. A trusted root is an essential premise. A proof constructed against an attacker's own root establishes only consistency with that attacker's commitment. Nor can a proof of inclusion establish the completeness of a wallet's history or a search result on its own.

Time-stamping adopted the tree for a different problem

Digital time-stamping was concerned with showing that a document was already committed to a service or public record by some independently observable time. Dave Bayer, Stuart Haber and W. Scott Stornetta used binary hash-tree aggregation in a paper whose surviving typescript is dated March 1992 and whose published chapter appeared in 1993. They acknowledged Merkle's earlier trees while applying them to bulk time-stamp verification and public commitments. Their proposal to anchor summary values in newspapers added an outside witness to the root; the tree alone supplied neither a clock nor a public record. Author-hosted typescript, sections 1 and 3 · Publisher record

The path between 1979 and Bitcoin is therefore not one uninterrupted protocol. An authentication tree for signatures, a batch of time-stamped documents and a block's transactions can share a data structure while answering different questions.

Bitcoin's ordered transaction commitment

Bitcoin places a Merkle root in each block header. Its ordinary transaction tree begins with transaction identifiers (txids) in block order, combines pairs using double SHA-256, and repeats until one root remains. An inclusion branch can show that a given txid belongs to the committed tree without sending every transaction in that block. But checking the branch and header is not the same as verifying every script, spend or consensus rule inside the block. Bitcoin Core transaction-root implementation · Bitcoin white paper

Bitcoin also makes a specific choice for an odd number of hashes at a level: it pairs the last hash with itself. With three transaction IDs A, B and C, the tree has the same root as the four-entry sequence A, B, C, C, even if the underlying hash function has no collision. The four-entry version is an invalid Bitcoin block, but the root and therefore the block header can be identical.

This structural ambiguity led to CVE-2012-2459. A node that first cached the invalid duplicate-transaction form as an invalid block could mistakenly reject the valid form sharing its header hash. Bitcoin Core's source explicitly warns about the odd-leaf rule and checks for duplicated subtrees; later fixes and refactors have had their own chronology. The problem should not be described as a demonstrated collision in SHA-256. It is two different leaf sequences producing the same root under this particular construction. Primary implementation and warning · Bitcoin Optech's technical history · Historical vulnerability catalogue

There is a second boundary: Bitcoin's ordinary transaction Merkle commitment authenticates txids, not every byte of later SegWit witness data. BIP 141 introduced a separate witness commitment in the coinbase for that purpose. Calling both simply “the Merkle root” hides two different commitments. BIP 141, witness commitment · Separate BlockMerkleRoot and BlockWitnessMerkleRoot

Similar name, different structure: Git

Git's stored objects refer to other objects by content hash, producing a Merkle-style directed acyclic graph for commits, trees and blobs. That is not Bitcoin's pairwise transaction tree with an odd-leaf duplication rule. In a Git-backed archive, commit ancestry records revisions; the cryptographic references make alterations detectable, while repositories, remotes and backups determine which objects remain available. A content hash does not guarantee long-term custody by itself. Git's object model

Evidence and open questions

  • Direct first-party invention record: US 4,309,569, filed 1979 and issued 1982. Patent filing is not a proven date of public dissemination.
  • First-party bibliographic evidence: Merkle's publications, which list the 1979 dissertation but are not themselves its complete text.
  • Later scholarly application: Digital time-stamping and the Bayer–Haber–Stornetta chapter.
  • Direct current software evidence: Bitcoin Core implementation, which documents Bitcoin-specific tree construction, distinct witness roots and mutation checks. Current source is not by itself a date for each historical fix.
Open question
Compare the complete June 1979 Stanford dissertation with the filed September 1979 patent, recording precise page-level correspondences and any changed claims or algorithms.
Open question
Reconstruct the dated Bitcoin Core commits for each post-2012 mutation-cache repair rather than relying solely on a later vulnerability timeline.

From the archivist's desk

This tree began as a way to avoid trusting an impossibly long list of individual signatures. Later it became a way to timestamp a pile of documents, then a way for Bitcoin to commit to an ordered block of transactions. The structure travelled well because it made a large collection checkable through a small witness. The catch is that every traveller brought their own rules for building the tree. Those rules belong in the historical record too.