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
Leaf-versus-node ambiguity and SPV proofs
The 2012 duplicate-last-leaf problem is not Bitcoin's only Merkle ambiguity. Leaf hashes and internal hashes both use double SHA-256 with no distinct prefix identifying which kind of object is being hashed. An internal tree node hashes the 64-byte concatenation of two 32-byte child hashes. A valid transaction with exactly 64 bytes of witness-stripped serialization can therefore also be read as a pair of purported child hashes.
This matters especially for simplified payment verification (SPV). A verifier that checks only a header and an inclusion branch, without independently establishing the transaction count and tree shape, may accept a branch extending a genuine 64-byte block transaction as though it were an internal node. The claimed deeper transaction need not actually occur in the block. A fully validating node checks the block's actual transaction list, scripts and tree shape; this is not evidence that the attack produces two differently transacting, valid Bitcoin blocks. Sergio Demian Lerner, first-person technical write-up · Bitcoin Optech, comparative technical account
Sergio Demian Lerner dates his discovery to 4 August 2017, his report to Bitcoin Core developers to 8 August 2017, and his public write-up to 9 June 2018. He also says that he learned during disclosure that some developers already knew the general weakness. These are '''researcher's retrospective chronology and attribution**, not proof that nobody discovered it earlier. His published cost estimates concern a proposed high-work attack, not a documented successful fraud; the blog states that its text was clarified on 12 May 2023. This weakness is generally catalogued as **CVE-2017-12842'''. First-party report, history and later edit note
Mutation-handling fixes and their dates
The original duplicate-transaction invalidity-cache issue, CVE-2012-2459, was fixed in 2012. A later vulnerability affected Bitcoin Core 0.13.0, 0.13.1 and 0.13.2, but it was not simply another duplicate-last-transaction block. It exploited the second ambiguity described above: bytes belonging to an interior row of Merkle nodes could be presented as a shorter list of apparent 64-byte transactions. The manipulated block message could then look invalid while retaining the genuine block's Merkle root and header hash. A node that cached the apparent invalidity could reject the actual valid block and fall out of consensus.
The original author of the vulnerable optimisation, Suhas Daftuar, described this mechanism in a 25 February 2019 Bitcoin-Dev disclosure. He explicitly contrasted the full-node attack, which pretends that inner nodes are transactions, with the separate light-client attack that pretends a 64-byte transaction is an inner node. Daftuar estimated that constructing the relevant invalid form would require less than 22 bits of work. He reported finding no corresponding exploitable main-chain instances in his survey as of February 2019; this is a first-party scan claim, not independently reproduced evidence about all possible chains or future blocks. He credited Johnson Lau and Gregory Maxwell with originally alerting him to the issue. Daftuar, Bitcoin-Dev disclosure, 25 February 2019 — first-party retrospective technical account
The implementation history is now traceable to two specific merged changes:
- 3 February 2016: Bitcoin Core PR #7225, “Eliminate unnecessary call to CheckBlock” (implementation commit
dbb89dc). Daftuar removed a preliminaryCheckBlock()call fromProcessNewBlock(). The intention was to avoid re-requesting invalid blocks by allowingAcceptBlock()to record failure. The unintended effect exposed the 64-byte internal-row invalidity-caching path. - 16 February 2017: Bitcoin Core PR #9765, “Harden against mistakes handling invalid blocks” (merged implementation commit
ba803ef). The patch restored the earlierCheckBlock()call as a belt-and-suspenders measure, effectively reverting the dangerous aspect of #7225. It also fixed an incorrectCheckBlock()invocation introduced through compact-block PR #8068. The changed code and accompanying tests are direct implementation evidence.
The fix therefore predates Bitcoin Core 0.14.0 (released March 2017), whereas public disclosure came in 2019, after 0.13 reached end of life on 1 August 2018. Daftuar's explanation identifies the introducing and repairing PRs directly; the release boundaries alone would not have done so. None of these patches changed the Merkle-root consensus serialization, and their chronology should not be collapsed into the original 2012 cache flaw or the 2017–2018 disclosure of the SPV weakness. Original optimisation and merge record · Repair and merge record · Author's disclosure and qualification
A separate network-level failure involving mutated block messages was reported in the Bitcoin Core development IRC channel on 8 May 2023. An unsolicited mutated block could prematurely clear another peer's block-download or compact-block reconstruction state and delay propagation. Suhas Daftuar's fix, Bitcoin Core PR #27608, was merged on 10 May 2023; Bitcoin Core 25.0 was released on 25 May. Bitcoin Core publicly disclosed the issue on 9 October 2024 as CVE-2024-52921. This is a peer download-state bug, not a claim that the old duplicate-leaf attack remained exploitable in precisely its 2012 form. Bitcoin Core security disclosure and dated timeline
On 28 February 2024, Bitcoin Core PR #29412 merged an early IsBlockMutated check for incoming block messages, aimed at rejecting known mutation forms before ordinary processing. Its stated rationale explicitly mentions earlier attacks involving mutated blocks and includes a regression test for the 2023 problem. This is an implementation-level defensive improvement, not a consensus-level redesign of the historical Merkle root. Primary pull-request record
A proof of the check, and a proposed rule change
On 1 July 2026, Keagan McClelland presented btc-verified, a Lean 4 formalisation of parts of Bitcoin's protocol. He described a machine-checked result connecting a simple Merkle specification with the memory-efficient Core-style algorithm: given its canonicality/mutation condition and hash collision resistance, different admissible tree structures cannot yield the same root. The condition matters: the proof is not a claim that the unrestricted Bitcoin tree construction is collision-free. McClelland's contemporary first-party Bitcoin-Dev announcement, 1 July 2026
McClelland explicitly warned that a proof about a formal model is '''not automatically a proof about Bitcoin Core's C++ execution**. He described the project as experimental, disclosed AI-authored code, and invited review. Bitcoin Optech's 17 July 2026 independent summary independently reported the claimed result, but that coverage does not constitute a separate formal audit.
Meanwhile, BIP 30 and Merkle-proof ambiguity have both become targets of the proposed **BIP 54'*, *Consensus Cleanup''. Its specification would make a transaction with exactly 64 bytes of witness-stripped serialization invalid after soft-fork activation, removing the relevant leaf/internal-node ambiguity for future blocks. It also proposes coinbase uniqueness rules addressing the older transaction-ID issue. BIP 54's changelog marks its drafted specification complete on 22 May 2026; complete as a document is not activated as a Bitcoin mainnet consensus rule. The proposed rules had already been experimentally activated on the Bitcoin Inquisition signet at block 291,168 in February 2026; test-network adoption does not change mainnet validity. The proposal records alternatives, including rejecting suspicious internal nodes rather than outlawing 64-byte transactions. BIP 54 specification and alternatives · Antoine Poinsot, contemporary Inquisition status report
The history separates four things that are easy to conflate: a structurally ambiguous commitment, a verifier that trusts too little context, an implementation that caches or relays the wrong conclusion, and a proposed change to what future blocks may contain. Each has its own fix and its own evidentiary trail.
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.
Compare the complete June 1979 Stanford dissertation with the filed September 1979 patent, recording precise page-level correspondences and any changed claims or algorithms.
Recover the raw data and reproduction procedure behind Daftuar's February 2019 main-chain scan for exploitable 64-byte internal-row cases; his published negative result should remain attributed until independently checked. Compare BIP 54's proposed Merkle mitigation against implementations and any future activation record before calling it consensus.
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.