In this track: Trees, roots and proofs
advanced · 4 MIN READ

Double-hashed leaf conventions

Some standard tree formats hash encoded leaves twice.

LET’S PICTURE IT

A separate envelope layer distinguishes a record fingerprint from a branch combination.

SEE IT FOR YOURSELF
Build a root and follow one membership proofStep 1 / 4
Build a root and follow one membership proofA0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4ROOT0x4e2b32…5956A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4ROOT0x4e2b32…5956

This example hashes UTF-8 A, B, C and D. The displayed hashes are abbreviated, and the tree uses the playground’s sorted-pair convention.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Recognize the specific convention

Some common allowlist libraries use Keccak-256 of a first leaf digest. Their verifier expects that same double-hashed leaf construction.

Understand the separation goal

Separating leaf representation from internal-node inputs helps avoid a raw leaf being interpreted like a concatenated pair of child hashes under unsuitable constructions.

Do not change one side only

Adding a second hash to an existing verifier while keeping the old tree root will generally break compatibility. Builder, root and verifier must agree.

Keep the playground convention explicit

This site’s text playground hashes each text leaf once and is an educational model. It does not claim to generate every library’s standard allowlist tree.

Follow the proof model

Example convention: leaf = H(H(standard encoded fields))
Playground convention: leaf = H(UTF-8 text)

These produce different trees.

Binary examples use the stated local playground convention. They are not Ethereum account or storage trie proofs.

TURN UNDERSTANDING INTO PRACTICEOpen the Merkle trees →
QUICK CHECK · NO PRESSURE

Can you add an extra leaf hash without changing the expected root construction?

Your progress stays in this browser.
Keep exploring the original referencedocs.openzeppelin.com ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.