Merkle tree
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.
Dynamo's 2007 design uses per-key-range trees to locate divergent replicas. [4] 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. [5]
In 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. [9]
Tree 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. [8]
Leaf/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. [1] 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. [2]
History-tree auditing separates membership from cross-commitment consistency. Auditors also compare commitments across observers to expose divergent views. [10]
Relations
- related
- Cryptographic hash function, 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 (CID)
Limitations
- A proof relative to a root does not by itself establish freshness, data availability or which divergent replica is authoritative. [5, 4]
- A Merkle tree does not reconstruct missing data; replica synchronization still needs the relevant data and reconciliation rules. [4]
Citations
- Bitcoin Core v28.0: duplicate-last Merkle construction and pre-padding mutation checks
- Hesela: tagged Merkle padding, exact controls and finite symbolic cross-check
- DeCandia et al. Dynamo: Amazon's Highly Available Key-value Store. SOSP 2007, section 4.7.
- RFC 9162: Certificate Transparency Version 2.0, sections 2.1 and 4.9-4.12
- Linux v6.12 dm-verity-target.c: fanout, levels and hash-block allocation
- Hesela: Merkle tree encoding counterexample, source and reproducible root values
- Crosby and Wallach: Efficient Data Structures for Tamper-Evident Logging. USENIX Security 2009, sections 2.1-2.2