{
  "slug": "merkle-tree",
  "term": "Merkle tree",
  "aliases": [
    "Hash tree"
  ],
  "definition": "A Merkle tree combines hashes of data and child nodes into a root so that selected entries or subtrees can be checked without transferring the entire data set.",
  "note": "Dynamo's 2007 design uses per-key-range trees to locate divergent replicas. [dynamo2007] For inclusion verification, use the intended trusted root and the construction's encoding, ordering and tree-shape rules. RFC 9162 specifies distinct leaf and internal-node prefixes and includes tree size and leaf index in proof verification; that is one construction, not a universal storage format. [rfc9162]\n\nIn a naive untagged binary construction, a single entry containing two child digests hashes to the same root as those two leaves: the outer hash sees identical bytes, not a cryptographic collision. The executable example also shows why an independently trusted entry count rejects that substitution. [hesela-merkle-example]\n\nTree arity is construction-specific. Linux v6.12 dm-verity uses a fanout derived from hash-block and digest sizes; 4096-byte hash blocks with SHA-256 hold 128 digests. Tree height alone is not an I/O count or latency prediction. [dm-verity-code]\n\nLeaf/node prefixes do not resolve every tree-shape ambiguity. With duplicate-last padding, ABC and ABCC can have the same tagged root; ABCDEF and ABCDEFEF repeat a subtree above the leaves. Bitcoin Core v28.0 documents the historical construction and checks equal sibling hashes before padding at each level. [bitcoin-merkle-v28] Hesela's separate SHA-256 model retains six control pairs and exhausts 2046 short A/B lists. Bind the expected count and construction to a trusted reference; repeated storage chunks can be legitimate, so a duplicate flag is not a universal rejection rule. [hesela-merkle-padding]\n\nHistory-tree auditing separates membership from cross-commitment consistency. Auditors also compare commitments across observers to expose divergent views. [crosby-history2009]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    {
      "text": "A proof relative to a root does not by itself establish freshness, data availability or which divergent replica is authoritative.",
      "citationIds": [
        "rfc9162",
        "dynamo2007"
      ]
    },
    {
      "text": "A Merkle tree does not reconstruct missing data; replica synchronization still needs the relevant data and reconciliation rules.",
      "citationIds": [
        "dynamo2007"
      ]
    }
  ],
  "related": [
    "cryptographic-hash",
    "hash-collision",
    "checksum",
    "end-to-end-data-protection",
    "anti-entropy-repair",
    "dm-verity",
    "fs-verity",
    "set-reconciliation",
    "dynamic-merkle-tree",
    "hash-domain-separation",
    "nvme-tcp-digest",
    "content-addressed-storage",
    "content-identifier"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "bitcoin-merkle-v28",
      "title": "Bitcoin Core v28.0: duplicate-last Merkle construction and pre-padding mutation checks",
      "url": "https://github.com/bitcoin/bitcoin/blob/110183746150428e6385880c79f8c5733b1361ba/src/consensus/merkle.cpp",
      "accessed": "2026-11-11"
    },
    {
      "id": "hesela-merkle-padding",
      "title": "Hesela: tagged Merkle padding, exact controls and finite symbolic cross-check",
      "url": "https://hesela.com/analyses/checksums-identity-and-lost-writes/#merkle-duplicate-padding",
      "accessed": "2026-11-11"
    },
    {
      "id": "hesela-merkle-padding-data",
      "title": "Hesela: generated Merkle-padding results (synthetic computation)",
      "url": "https://hesela.dev/research/merkle-padding/results.json",
      "accessed": "2026-11-11"
    },
    {
      "id": "dynamo2007",
      "title": "DeCandia et al. Dynamo: Amazon's Highly Available Key-value Store. SOSP 2007, section 4.7.",
      "url": "https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf",
      "accessed": "2026-10-12"
    },
    {
      "id": "rfc9162",
      "title": "RFC 9162: Certificate Transparency Version 2.0, sections 2.1 and 4.9-4.12",
      "url": "https://www.rfc-editor.org/rfc/rfc9162.html",
      "accessed": "2026-10-12"
    },
    {
      "id": "hesela-integrity",
      "title": "Hesela: Why a valid checksum can still return the wrong data",
      "url": "https://hesela.com/analyses/checksums-identity-and-lost-writes/",
      "accessed": "2026-10-12"
    },
    {
      "id": "hesela-repair",
      "title": "Replica repair: what has actually converged?",
      "url": "https://hesela.com/analyses/replica-repair-coverage/",
      "accessed": "2026-10-13"
    },
    {
      "id": "dm-verity-code",
      "title": "Linux v6.12 dm-verity-target.c: fanout, levels and hash-block allocation",
      "url": "https://github.com/torvalds/linux/blob/v6.12/drivers/md/dm-verity-target.c",
      "accessed": "2026-10-18"
    },
    {
      "id": "hesela-merkle-example",
      "title": "Hesela: Merkle tree encoding counterexample, source and reproducible root values",
      "url": "https://hesela.com/analyses/checksums-identity-and-lost-writes/#merkle-domain-separation",
      "accessed": "2026-10-18"
    },
    {
      "id": "crosby-history2009",
      "title": "Crosby and Wallach: Efficient Data Structures for Tamper-Evident Logging. USENIX Security 2009, sections 2.1-2.2",
      "url": "https://static.usenix.org/events/sec09/tech/full_papers/crosby.pdf",
      "accessed": "2026-11-12"
    }
  ],
  "updated": "2026-11-12"
}
