Proving That Something Is Not There - Sparse vs Indexed Merkle Trees
A Merkle proof usually shows that something is in a set: this certificate was logged, this address is on the allowlist. Many protocols need the opposite statement. A private payment system must show that a note’s nullifier has never been published, or the note could be spent twice. A revocation service must show that a certificate is not in the revocation list. A plain Merkle tree cannot prove either: its root commits to a list of leaves, and a proof only shows what sits at one position.
This article compares the two structures most used for proofs of absence. The sparse Merkle tree gives every possible key its own leaf, so absence is an empty leaf. The indexed Merkle tree keeps the stored keys in a sorted linked list, so absence is a gap between two neighbours. The second one is what Aztec uses for its nullifier tree, because it costs far fewer hashes inside a zero-knowledge circuit. A small script builds both trees, proves membership and absence, and runs four broken indexed-tree verifiers and one unsafe sparse-tree encoding, each of which lets a present key pass as “absent”.
This article has been made with the help of Claude Code and several custom skills
What you need to know first
The article assumes the following:
- Merkle tree and inclusion proof. A binary tree of hashes whose root commits to its leaves; a proof is the list of sibling digests from a leaf to the root. Auditing Merkle Proofs in Solidity covers how contracts check such proofs.
- Collision resistance. Finding two inputs with the same hash is infeasible; the security of every proof below reduces to it.
- Zero-knowledge circuit cost. A proof system such as a SNARK proves that a computation was done correctly. Its cost grows with the number of constraints, and a hash is one of the most expensive operations to express; see zk-SNARK overview.
- Nullifier. In a private payment system, spending a note publishes a value derived from it, the nullifier. The protocol must check that the nullifier was never published before. How Aztec Works describes notes and nullifiers in Aztec.
- Field element. Circuits work over a prime field; for Aztec’s BN254 curve an element has 254 bits, which sets the depth of a sparse tree keyed by field elements.
Why absence needs a special tree
A Merkle root commits to a sequence of leaves. An inclusion proof shows that one value sits at one position. To prove that a value is nowhere in the tree, a verifier would have to see every leaf, unless the layout of the tree tells it where the value would have to be.
The Verdict paper, by Tzialla, Kothapalli, Parno and Setty, states the limitation in one line: plain Merkle trees “do not support succinct proofs of non-membership nor insertion”. There are two ways around it:
- The key decides the position. Give each possible key its own leaf. A key is absent exactly when its leaf is empty, and a normal inclusion proof of the empty leaf proves it. This is the sparse Merkle tree.
- The order decides the position. Keep the stored keys sorted. A key is absent when two neighbours that are adjacent in the sorted order bracket it. A sorted search tree proves the bracket with a binary-search path. In an indexed Merkle tree, the lower neighbour’s leaf records the upper neighbour, so a proof of that one leaf is enough.
Dahlberg, Pulls and Peeters describe both families in their paper on sparse Merkle trees (ePrint 2016/683, section 3.1). A balanced search tree used as a Merkle tree proves absence “through binary search”, but it needs rotations on insertion, and its root can depend on the order of insertions.
flowchart TD
Q["Is key k in the committed set?"] --> P{"How is a key's position fixed?"}
P -->|"by the key itself"| S["Sparse Merkle tree<br/>leaf index = k"]
P -->|"by sorted order"| I["Indexed Merkle tree<br/>linked list of sorted keys"]
S --> SA["Absent: the leaf at index k is empty"]
I --> IA["Absent: one stored leaf has<br/>value below k and next value above k"]
Proofs of absence appear in several places this blog has covered; Ethereum’s state trie, a third design, comes back in Where these trees are used. Certificate Transparency’s append-only log cannot prove that a certificate is absent. Dahlberg et al. cite this to motivate their sparse trees: “the absence of a revocation certificate” cannot “be proven efficiently” in such a log.
Sparse Merkle trees: one leaf for every possible key
Definition and default digests
Dahlberg et al. define a sparse Merkle tree as “a perfect Merkle tree of intractable size” that “contains a distinct leaf for every possible output from a cryptographic hash function”. With SHA-512/256 as in their implementation, the tree has 2^256 leaves.
The key’s hash selects the leaf, and the key is a member if the leaf holds the attribute a1 and a non-member if it holds a0, the attribute shared by every empty leaf. Hashing spreads arbitrary keys over the leaves. A key that is already a uniform field element, such as a nullifier, can select its leaf directly; the Aztec documentation does so, which gives a depth of 254 for BN254 elements.
Such a tree cannot be stored, but it can be computed, because almost every subtree is empty. All empty subtrees of the same height have the same digest. Precompute them once: the empty leaf d0, then d1 = H(d0 || d0), d2 = H(d1 || d1) and so on up to the root of a fully empty tree. Only the subtrees that contain at least one stored key are hashed for real.
The paper’s caching strategies keep the digests of “branches”, the interior nodes whose two children are both non-empty. That way, when the server builds a proof or updates the root, the number of traversals below a cached node stays bounded, even for keys an attacker picks: at most one per level for the cache that keeps every branch.
Proofs of membership and of absence have the same shape
Both proofs are an inclusion proof for the leaf at the key’s index:
- Membership: the leaf holds the key’s value; the verifier hashes it and climbs with the siblings to the root.
- Absence: the leaf is empty; the verifier starts from the empty-leaf value and climbs with the same kind of siblings.
The proof always has one sibling per level, so its length is the depth of the tree. Most of those siblings are default digests the verifier already knows. The paper notes that a proof “can be further reduced by discarding default digests”: the prover sends a bitmap that says which levels have a non-default sibling, and only those siblings. The verifier must then use every sibling it receives and no more. A verifier that ignores leftover siblings accepts a proof with extra bytes appended, so one statement gets many valid encodings: the proof becomes malleable, although the verified claim does not change.
History independence
Because a key’s position depends only on the key, the same set of keys always gives the same root, “regardless of the order in which keys have been inserted or removed”. The paper calls this history independence and notes that a sorted tree such as a red-black tree does not necessarily have it.
Node encoding
For one tree with a fixed hash function, the paper shows that the proof’s fixed length already separates leaves from inner nodes.
The harder case is an attacker who targets many trees at once, which the paper calls the multi-instance setting: without separation, one search for a colliding node could be used against any tree or any position. In CONIKS’s tree, which encodes both a tree-wide constant and each leaf’s location, “an adversary must target a particular tree and location” (section 5.1).
The paper’s own encoding, in section 5.2, keeps the same constant across updates, so it does not protect against attacks on past versions of the same tree. Empty subtrees must keep one shared default digest per height, or the tree is no longer sparse, so the encoding adds the position only where a subtree holds data:
- a tree-wide constant in every leaf hash, plus the leaf’s position (its base) in every non-empty leaf;
- the position in every interior hash whose children are not both default: the base, which is the index of the leftmost leaf under the node, and the height.
Worked example: a sparse tree of depth 8
The script nonmembership.py in the verification directory builds a sparse tree of depth 8 with SHA-256. Key k (0 to 255) sits at leaf index k. A stored leaf is SHA-256(0x00 || k || value), an empty leaf is 32 zero bytes, and an inner node is SHA-256(0x01 || left || right). It stores keys 3, 77 and 200.
The proof that key 100 is absent is an inclusion proof of the empty leaf at index 100. In binary, 100 is 01100100. Reading from the root, the path goes left (bit 0), then right twice, then down through a subtree that holds no key.
Heights count from the leaves: the leaves are at height 0 and the root’s children at height 7. Each sibling is named by its height, and bit h of the bitmap marks the sibling at height h, printed with height 7 on the left. In the diagram, the path nodes are marked “path” and the three siblings that must be sent are marked “sent”:
flowchart TD
R["root<br/>472435c0…"] --> L0["path, height 7<br/>prefix 0"]
R --> R1["sent: sibling at height 7, bit 1<br/>prefix 1, holds key 200"]
L0 --> L00["sent: sibling at height 6, bit 1<br/>prefix 00, holds key 3"]
L0 --> L01["path, height 6<br/>prefix 01"]
L01 --> L010["sent: sibling at height 5, bit 1<br/>prefix 010, holds key 77"]
L01 --> L011["path, height 5<br/>prefix 011, no key"]
L011 --> E["heights 4 to 0: siblings are<br/>default digests, bits 0, not sent"]
E --> LEAF["path, height 0<br/>leaf 100 = empty"]
The script’s output gives the numbers:
| Item | Value |
|---|---|
| Root of the empty tree | 8e4b3745e5f2f7d4… |
| Root with keys 3, 77, 200 | 472435c03905b4e4… |
| Non-default siblings for key 100 | heights 5, 6 and 7 (the subtrees holding 77, 3 and 200) |
| Full proof | 8 siblings, 256 bytes |
| Compressed proof | bitmap 11100000 and 3 siblings, 96 bytes |
All the script’s checks pass. It accepts the membership of key 77 and the absence of key 100. It rejects a wrong value for 77 and an “absent” claim for 77. The compressed proof expands to the full one, and a compressed proof with one extra, unused sibling is rejected. Inserting the three keys in another order gives the same root.
Indexed Merkle trees: a sorted linked list in the leaves
Verdict’s design
Verdict is a transparency dictionary: an untrusted service keeps a label-value map that clients query and update, and proves that it handles every update correctly. It needed proofs of non-membership and insertion that are cheap to check inside a SNARK. Section III of the paper reviews the existing options and rejects each one:
- Sparse and Merkle-Patricia trees: paths “are of variable length”, so circuits for them are complex. The full-depth sparse tree above has a fixed length, but practical forms shorten paths: a Patricia trie stops at the first node that holds a single key, as the account proof in eth_getProof step by step shows, and the compressed proofs above drop default siblings. Keeping the full depth of 256 makes these trees circuit-friendly, but “incurs over an order of magnitude higher costs at our collection sizes (2^20–2^30 items)”.
- Merkle-AVL trees: they “require rebalancing upon insertion”.
- RSA accumulators: they need a trusted setup and big-number arithmetic.
The paper’s answer, the indexed Merkle tree, is “a standard Merkle tree” whose leaves carry one more field. A leaf is ⟨active, label, value, next⟩, where next is the next larger label stored in the tree. Two labels are reserved: all zeros as the lowest and all ones as the highest. Labels and values have a fixed width of w bits. At initialization the leftmost leaf holds ⟨1, 0^w, 0^w, 1^w⟩, a list with only the two sentinels, the reserved lowest and highest labels. The structure keeps one invariant: for every active leaf, either next is the highest label, or a leaf holding next exists and no active label lies strictly between the two.
The three sources name the same things differently. This article calls the looked-up item the key:
| This article | Verdict | Aztec code | Aztec documentation and the worked example |
|---|---|---|---|
| key | label | nullifier |
value |
| next key | next | next_nullifier |
next_value |
| position of the next leaf | (not stored) | next_index |
next_index |
| payload stored with the key | value | (none in a nullifier tree) | (none) |
With the invariant stated above, the proofs follow:
- Absence of label
ℓ: show, with an ordinary inclusion proof, the unique leaf⟨1, low, v, high⟩withlow < ℓ < high. - Insertion of
ℓ: prove its absence with that leaf, set the leaf’snexttoℓ, then fill an inactive leaf with⟨1, ℓ, v, high⟩. Each step is an update proof against the current root. - Capacity: the tree has a fixed number of leaves and fills up. Its size can then be doubled: if
ris the current root, the root of the doubled tree ishash(r, r0), wherer0is the root of an equally large tree of default leaves, which a verifier computes with a logarithmic number of hashes.
The path length is the depth of the tree, which is fixed and small, because a leaf’s position does not depend on its key. Verdict notes that the leaves “are not sorted”: a new label “can be inserted at any ‘inactive’ leaf node”. Aztec, below, chooses to append each new leaf at the next free index.
Aztec’s nullifier tree
Aztec uses the same idea for its nullifier tree. The protocol code at commit e8e6465 (10 September 2026) defines a leaf as NullifierLeafPreimage { nullifier, next_nullifier, next_index }. The leaf stores the next value and its position, so the next leaf can be found without a search. The Aztec documentation calls the bracketing leaf the low nullifier.
Inserting a new nullifier k takes these steps (documentation, “The insertion protocol”); low.value is the low leaf’s key:
- Find the low leaf: the stored key just below
k. - Check the low leaf’s membership against the current root.
- Check
low.value < k, andk < low.next_valueunless the low leaf is the largest one. - Point the low leaf to
k:next_value = k,next_index= the insertion index. Recompute the root. - Append the new leaf with the low leaf’s old pointers:
(k, old next_value, old next_index). Recompute the root.
The largest value in the list has no successor. The code says that such a leaf “points to infinity”, and recognises it by a next value and a next index that are both zero. A leaf is a valid low leaf for a key when its value is below the key, and the key is below its next value or the leaf points to infinity.
Implementation: points_to_infinity in nullifier_leaf_preimage.nr and is_valid_low_leaf in low_leaf.nr.
The tree does not start empty.
Barretenberg, the elliptic-curve and PLONK prover library in Aztec’s repository, also holds the tree code. Its indexed tree fills its first leaves with “padding” keys 0, 1, 2… chained in increasing order, with the last one pointing back to index 0. The tree’s initial size, which counts the padding leaves plus any prefilled values, is a parameter, and the code refuses a size below two: “Indexed trees must have initial size > 1”.
Leaf 0 is then (0, 1, 1), not the all-zero preimage, so every leaf in use is non-empty. That matters to the verifier, as The empty leaf as a low leaf shows.
Implementation: content_addressed_indexed_tree.hpp in Barretenberg’s crypto/merkle_tree/indexed_tree/.
Worked example: an indexed tree of depth 3
The script builds an indexed tree of depth 3 (8 slots) with the Aztec layout and SHA-256 in place of Poseidon2. A leaf (value, next_value, next_index) hashes to SHA-256(0x00 || value || next_value || next_index), except the all-zero preimage, which the script, like Aztec’s NullifierLeafPreimage::hash, maps to 0 without hashing. 0 is also the value of an empty slot. The tree starts with two padding leaves, 0 and 1, then receives 30, 10, 20 and 50, the sequence of the Aztec documentation’s example. The leaves end up in insertion order, while the pointers follow the sorted order:
| Index | value | next_value | next_index | Leaf hash |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | b720b646… |
| 1 | 1 | 10 | 3 | fcc21852… |
| 2 | 30 | 50 | 5 | e9703f63… |
| 3 | 10 | 20 | 4 | 7183bbcc… |
| 4 | 20 | 30 | 2 | bf7112ad… |
| 5 | 50 | 0 | 0 | 71ecf560… |
| 6, 7 | empty | 0 |
The root is 155d295d26202d6b…. Following next_index from leaf 0 visits 0, 1, 10, 20, 30, 50:
flowchart LR
A["index 0<br/>value 0"] --> B["index 1<br/>value 1"]
B --> D["index 3<br/>value 10"]
D --> E["index 4<br/>value 20"]
E --> C["index 2<br/>value 30"]
C --> F["index 5<br/>value 50"]
F --> G["infinity<br/>next_value 0, next_index 0"]
Two proofs of absence pass:
- 25 is absent: the low leaf is index 4,
(20, 30, 2), and 20 < 25 < 30. The proof is that leaf’s preimage and its three siblings. - 60 is absent: the low leaf is index 5,
(50, 0, 0), which points to infinity, and 50 < 60.
The membership of 20 is the same kind of proof with the leaf whose value equals the key.
Inserting 25 then follows the five steps above. The low leaf of 25 is leaf 4, and the next free slot is 6. Step 4 rewrites leaf 4 from (20, 30, 2) to (20, 25, 6), and step 5 fills leaf 6 with (25, 30, 2), the pointer leaf 4 held before. No other leaf changes, and the root moves from 155d295d… to 783b9497…. The diagram shows the two changed leaves, with the old link dashed:
flowchart LR
E["leaf 4, before: (20, 30, 2)<br/>after step 4: (20, 25, 6)"] -.->|"before: next is index 2"| C["leaf 2: (30, 50, 5)<br/>unchanged"]
E -->|"step 4: next is index 6"| N["leaf 6, appended in step 5<br/>(25, 30, 2)"]
N -->|"inherited pointer: index 2"| C
Why the indexed tree is cheaper in a circuit
A circuit pays for every hash on a path. For a sparse tree keyed by a BN254 field element the path is 254 levels long. The Aztec documentation counts the cost of an insertion as a non-membership check plus an insertion, “two trips from leaf to root”, so 254 × 2 hashes.
Because keys land at random positions, sparse insertions “must be sequential”: scattered keys do not form one subtree, so each insertion needs its own full path, computed from the root left by the previous one. The hash count therefore grows by about 508 per nullifier. An indexed tree appends new leaves side by side, so a batch forms one subtree and the upper levels of its path are hashed once for the whole batch.
An indexed tree’s depth only has to cover the number of values ever inserted. The documentation uses 32 levels and estimates the gain at “approximately 8x (256 / 32)”, rounding the 254 levels to 256. It lists the constraints of one insertion as follows. The 3h hashes match the three paths of the insertion steps: the membership of the low leaf, its update, and the append of the new leaf.
3hhashes of two field elements, for a tree of heighth;- 3 hashes of three field elements;
- 2 range checks;
- a few equality constraints.
For a batch of four values, it counts 2,032 hashes in a sparse tree (4 × 2 × 254) against 327 in a depth-32 indexed tree. Its breakdown of the 327 is one non-membership check and one pointer update per value, 32 hashes each, “plus subtree construction (~67 hashes)”; those terms add up to 323, so the documentation does not show where the last 4 come from. The documentation adds that “range check constraint costs are negligible compared to hash costs”.
The current protocol code uses a larger tree than the documentation. The nullifier tree has the height of the note hash tree, 42, sized by the comment “64 notes/tx …, 15tps, for 100 years”. A path of 42 hashes is still about a sixth of 254. The documentation’s batch figure was not recounted for height 42. The per-insertion counts follow directly from the formulas above:
| Tree | Height | Hashes on paths per insertion | Batch of four (documentation) |
|---|---|---|---|
| Sparse, BN254 keys | 254 | 2 × 254 = 508 | 2,032 |
| Indexed, documentation | 32 | 3 × 32 = 96 | 327 |
| Indexed, current code | 42 | 3 × 42 = 126 | not given |
Implementation: NULLIFIER_TREE_HEIGHT and NOTE_HASH_TREE_HEIGHT in constants.nr.
The indexed tree pays elsewhere:
| Sparse Merkle tree | Indexed Merkle tree | |
|---|---|---|
| Position of a key | fixed by the key | not fixed by the key (Aztec: order of insertion) |
| Proof of absence | empty leaf at the key’s index | low leaf with low < key < next |
| Path length | key size (254 for a field element) | tree height (42 in Aztec’s code) |
| Leaves changed by an insertion | 1 | 2 (low leaf and new leaf) |
| Same root for the same set | yes, whatever the order | no, the order of insertion changes it |
| Finding the proof | direct from the key | a search for the low leaf |
| Batch insertion in a circuit | no, each key needs its own full path | yes, as one appended subtree (Aztec) |
The script checks the row “Same root for the same set”: inserting 10 then 30, or 30 then 10, into the same initial tree gives two different roots. The documentation names the search cost as the main drawback. Finding the low nullifier “requires searching existing nodes”, which a node speeds up by keeping a sorted copy of the values, at the cost of storage.
What a verifier must check
A proof of absence in an indexed tree has two parts, a range check and a membership proof, and each part has a way to fail. The script runs four broken indexed-tree verifiers. Each accepts a key as absent when it is present, and the correct verifier rejects all four proofs. The first three subsections below are the three cases on the worked-example tree; “The meaning of infinity” is the fourth, on another tree layout. The last three subsections cover sparse trees and any tree.
flowchart TD
IN["Claim: key k is absent<br/>input: low leaf preimage, index, siblings"] --> C1{"low leaf is not the empty leaf?"}
C1 -->|"no"| X1["reject"]
C1 -->|"yes"| C2{"low value strictly below k?"}
C2 -->|"no"| X2["reject"]
C2 -->|"yes"| C3{"k below next value,<br/>or low leaf points to infinity?"}
C3 -->|"no"| X3["reject"]
C3 -->|"yes"| C4{"low leaf hashes up to the root?"}
C4 -->|"no"| X4["reject"]
C4 -->|"yes"| OK["accept: k is absent from this root"]
A strict lower bound
The low leaf must satisfy low < key, not low <= key. With <=, the leaf that holds the key itself, (20, 30, 2), passes as the low leaf of 20, and the verifier concludes that 20 is absent. Aztec’s tests include this case: a leaf whose value equals the key is rejected (invalid_low_leaf_equal_to_key in low_leaf.nr). In a nullifier tree, that mistake is a double spend: the same nullifier passes the absence check and is inserted a second time.
On the sorted list of the worked example, the three cases of this subsection and the next sit as follows. Each dotted arrow is a claim that the key is absent, labelled with what the verifier does with it:
flowchart LR
V0["0"] --> V1["1"] --> V10["10"] --> V20["20"] --> V30["30"] --> V50["50"]
K25["key 25"] -.->|"between 20 and 30: valid"| V20
K20["key 20"] -.->|"equal to the low value: rejected by the strict test"| V20
F["invented leaf (19, 21)"] -.->|"not in the list: rejected by the membership check"| V20
The empty leaf as a low leaf
The all-zero preimage (0, 0, 0) is the dangerous one when it hashes to the value of an empty slot. It passes the range test for every key: 0 is below any positive key, and with next_value = 0 and next_index = 0 it “points to infinity”. It also passes the membership test at any empty index, because its hash is the empty slot’s value. In the script, the empty leaf at index 7 “proves” that 20, 30 and 50 are absent, although all three are stored; the script tests those three, and any other key would pass in the same way.
Aztec’s code handles both of its indexed trees:
- Nullifier tree: the empty preimage hashes to 0 on purpose. A transaction’s nullifiers are inserted as a batch of fixed size, and a batch with fewer nullifiers is filled with empty entries. Those entries must leave the tree unchanged, so an empty leaf must hash to the empty-slot value. Batch insertion therefore asserts that the low leaf is not empty, with the comment “Empty leaves may pass validation as low leaves, but they cannot be updated in the tree” (
indexed_tree.nr). - Public data tree: Aztec’s second indexed tree, keyed by public storage slot, hashes every field of a leaf, empty or not. Its empty preimage therefore does not hash to 0, the empty-slot value, so the membership check fails.
storage_read.nrsays so: an empty preimage “would pass validation as a low leaf”, but “will fail the membership check”.
The reusable helper check_non_membership (membership.nr) does not reject the empty leaf itself. A new caller has to choose explicitly: either reject the empty preimage, or make the empty preimage hash to a value other than the empty-slot value.
The membership of the low leaf
The range check alone proves nothing. A verifier that only compares numbers accepts an invented leaf (19, 21, 3) as the low leaf of 20. The proof must also show that the leaf’s hash climbs to the trusted root.
The meaning of “infinity”
The largest leaf must be recognised in exactly one way, and the way must match how the tree was built. Aztec’s code requires both next_nullifier == 0 and next_index == 0. The documentation is looser:
- the insertion steps test
next_value == 0; - the non-membership example tests
next_index == 0.
In Aztec’s tree the two agree: only the last leaf points back to index 0, whose value is the padding 0. A verifier written from the documentation alone could pick one field, then meet a tree where the two conditions differ. The script builds such a tree, where index 0 holds a real key: leaves (20, 30, 2), (10, 20, 0) and (30, 0, 0). A verifier that tests next_index == 0 alone takes (10, 20, 0) for the last leaf and accepts 30 as absent, although 30 is stored; the full test rejects it.
Verdict avoids the special case. Its largest leaf points to the reserved highest label 1^w, so the same test low < key < next applies to every leaf. Aztec marks the end with a zero pointer instead, which every verifier must recognise in the same way.
The empty value in a sparse tree
A sparse tree needs an empty-leaf value that no stored entry can produce. The script’s “naive” variant uses the raw value as the leaf. Storing the value 0 at key 42 then leaves the root equal to the root of the empty tree, so “42 is absent” still verifies although 42 was written. Hashing a prefix, the key and the value (SHA-256(0x00 || k || v)) removes the collision: storing 0 changes the root.
Every element of a compressed proof
When default siblings are dropped and replaced by a bitmap, the verifier must use each supplied sibling exactly once. The script rejects a compressed proof that carries one sibling more than its bitmap announces.
One root at a time
A proof of absence is a statement about one root. A nullifier that is absent from an old root may have been inserted since. A protocol that accepts proofs against past roots must make sure that a past root cannot be used to approve a value that is now present. The safe choice is to prove absence against the root that the insertion itself updates, as Aztec’s batch insertion does.
Where these trees are used
- Revocation and key transparency. Dahlberg et al. motivate their sparse tree with Revocation Transparency, an extension of Certificate Transparency proposed by Laurie and Kasper, note that its scope “goes far beyond” it, and compare it with CONIKS’s Merkle prefix tree.
- Transparency dictionaries. Verdict combines indexed Merkle trees with a SNARK, Phalanx, so that a service proves that a whole batch of dictionary updates is correct with a proof of amortized constant size.
- Aztec. The nullifier tree and the public data tree are indexed trees. The nullifier tree’s absence check stops double spends. The public data tree’s low leaf proves that a storage slot was never written, in which case the read returns 0 (
public_data_storage_read). - Ethereum. The state trie is neither of the two: it is a Merkle Patricia trie, where absence is a path that stops at an empty branch child, at a leaf for another key, or inside an extension. See eth_getProof step by step.
Conclusion
Proving that a key is not in a set needs a tree whose shape tells the verifier where the key would be:
- Sparse Merkle trees place each key at its own leaf. Absence is an empty leaf, the root does not depend on the order of insertions, and proofs compress well. The path is as long as the key: 254 hashes for a BN254 field element.
- Indexed Merkle trees place leaves independently of their key (Aztec appends them in order) and link them by value. Absence is one stored leaf whose value and successor bracket the key. The path is as short as the tree’s height (42 in Aztec’s code), and batches insert as one subtree. The cost is a search for the low leaf, two leaves to update per insertion, and a root that depends on the order of insertions.
- The verifier is where the bugs are. A non-strict comparison, an empty low leaf that hashes to the empty slot, a range check without a membership proof, or an inconsistent definition of the last leaf each turns a present key into an absent one. For a nullifier that means a double spend.
- Aztec’s code shows the checks in practice. It rejects empty low leaves at insertion, relies on a non-zero empty hash in the public data tree, and tests that a leaf equal to the key is not a valid low leaf.

Annex
Key Terms
| Term | Definition |
|---|---|
| Proof of non-membership | A proof that a key is not in the set committed to by a root. |
| Sparse Merkle tree | A Merkle tree with one leaf for every possible key, almost all of them empty, computed with precomputed digests of empty subtrees. |
| Default digest | The digest of an empty subtree of a given height; the same for every empty subtree of that height. |
| Compressed proof | A sparse-tree proof that replaces default siblings by a bitmap and sends only the non-default ones. |
| History independence | The property that the same set gives the same root, whatever the order of insertions and removals. |
| Indexed Merkle tree | A Merkle tree whose leaves form a sorted linked list: each leaf stores its value and the next larger value. Aztec’s is append-only. |
| Low leaf (low nullifier) | The stored leaf whose value is just below a key; with its successor above the key, it proves the key’s absence. |
| Points to infinity | Aztec’s marker for the largest leaf: next_value and next_index both zero. |
| Nullifier | A value published when a private note is spent; its absence from the nullifier tree shows that the note was not spent before. |
| Public data tree | Aztec’s second indexed tree, keyed by public storage slot; its low leaf proves that a slot was never written. |
| Range check | The comparison of a key with the low leaf’s value and next value; in a circuit, a constraint that one field element is below another. |
| Sentinel | A reserved key that marks an end of the sorted list, such as Verdict’s all-zeros and all-ones labels. |
| Poseidon2 | The hash function Aztec’s circuits use for leaves and inner nodes. |
| Barretenberg | The elliptic-curve and PLONK prover library in Aztec’s repository, which also holds the tree code. |
| Padded batch | A fixed-size batch of nullifiers whose unused entries are empty leaves that must leave the root unchanged. |
| Padding leaves | The leaves with values 0, 1, 2… that an Aztec indexed tree holds at genesis, so that no leaf in use is empty. |
Verifier checklist
- For an indexed tree, the low leaf is not the empty preimage, or the empty preimage cannot hash to the empty-slot value.
- The comparison is strict:
low < key. - The upper bound is
key < next, unless the low leaf is the largest one, and “largest” is defined exactly as the tree builder defines it. - The low leaf’s preimage hashes, with its siblings, to the trusted root.
- The root is the one the protocol means: the current root for an insertion, or a root whose age the protocol accepts.
- For a sparse tree, the empty-leaf value cannot be produced by a stored entry.
- A compressed proof uses every supplied sibling exactly once, and the path has exactly one sibling per level.
Timeline
Events up to 3 December 2026.
| Date | Event | Why it matters here | Source |
|---|---|---|---|
| 1987 | Merkle publishes the hash-tree construction at CRYPTO. | The structure both designs extend. | Reference 21 in Dahlberg et al. |
| 2012 | Laurie and Kasper propose Revocation Transparency, with a sparse Merkle tree simulated from a set of keys. | The design Dahlberg et al. complete. | Reference 17 in Dahlberg et al. |
| 2015 | CONIKS uses a Merkle prefix tree for key transparency. | The explicit variant that Dahlberg et al. compare against. | Reference 20 in Dahlberg et al. |
| August 2016 | Dahlberg, Pulls and Peeters publish recursive definitions, caching strategies and a secure encoding for sparse Merkle trees (ePrint 2016/683). | The sparse-tree definitions used in this article. | ePrint 2016/683 |
| September 2021 | Tzialla, Kothapalli, Parno and Setty introduce indexed Merkle trees in Verdict (ePrint 2021/1263). | The origin of the indexed design. | ePrint 2021/1263 |
| 10 September 2026 | Aztec’s protocol circuits at commit e8e6465 use indexed trees for nullifiers and public data, with a nullifier tree of height 42. |
The production design analysed here. | aztec-packages |
Frequently Asked Questions
Q: Why can a plain Merkle tree not prove that a value is absent?
Its root commits to a list of leaves, and an inclusion proof only shows what is at one position. Nothing in the tree says where a given value would be, so absence could only be shown by revealing every leaf.
Q: In a sparse Merkle tree, how does a proof of absence differ from a proof of membership?
The two proofs have the same form. Both are inclusion proofs for the leaf at the key’s index; the membership proof starts from the hash of the stored value, the absence proof from the empty-leaf value. Both have one sibling per level.
Q: Why does Aztec use an indexed tree rather than a sparse tree for nullifiers?
A sparse tree keyed by a BN254 field element is 254 levels deep, and each insertion needs a non-membership check and an update, about 508 hashes in a circuit. An indexed tree’s depth only has to cover the number of nullifiers (42 in the current code), and new leaves can be inserted as one subtree. At the documentation’s depth of 32, it counts 2,032 against 327 hashes for a batch of four; that figure was not recounted for height 42.
Q: What goes wrong if a verifier accepts low <= key instead of low < key?
The leaf that holds the key becomes a valid “low leaf” for the key itself, so a present key verifies as absent. In a nullifier tree, the same nullifier could then be inserted twice, which is a double spend.
Q: Why is the all-zero leaf a danger in Aztec’s nullifier tree, and how does the code handle it?
The empty preimage hashes to 0, the value of an empty slot, so it passes the membership check at any empty index. With next_value and next_index both 0 it also “points to infinity”, so it passes the range check for every key. Batch insertion therefore asserts that the low leaf is not empty. The public data tree avoids the problem differently: its empty preimage does not hash to 0, so the membership check fails.
Q: Two nodes insert the same set of nullifiers in different orders. Do they get the same root?
Not with an indexed tree: leaves are appended in insertion order, so the positions, and the root, depend on the order. The script shows two different roots for the orders 10, 30 and 30, 10. A sparse tree would give the same root, because each key has a fixed position. A protocol with an indexed tree must fix the insertion order, which Aztec’s batch insertion does: new leaves keep their original order in the appended subtree.
Gaps
The sources leave these points open:
| Gap | Why it matters | What to read or verify |
|---|---|---|
| The Aztec documentation gives a depth of 32 and the code a height of 42. | The documentation’s hash counts (8x, 327 hashes) are for depth 32, not for the deployed height. | constants.nr at the commit in use; recount with height 42. |
| The documentation’s breakdown of the batch cost (4 × (32 + 32) + 67) gives 323, not the 327 it states, and “~67” is approximate. | The exact batch cost is not known from the sources. | The base rollup circuit’s hash count for a nullifier batch. |
The initial size of Aztec’s deployed trees is not confirmed. A comment in public_data_tree_leaf_preimage.nr gives 128 for the public data tree, and the world-state code in the labs submodule sets the nullifier tree’s initial size to 2 * MAX_NULLIFIERS_PER_TX, that is 128. Whether the deployed node uses that code was not checked. |
The worked example uses two padding leaves, the library’s minimum, as a reduced version. | labs/yarn-project/world-state/src/world-state-db/merkle_tree_db.ts and the node’s genesis configuration. |
Only reads of the public data tree (public_data_storage_read) and nullifier insertion were read. |
Writes to the public data tree and other absence checks may use other code paths. | The rollup’s public data update code and nullifier read requests. |
| Whether Aztec accepts nullifier absence proofs against past roots was not checked. | “One root at a time” describes the insertion path only. | The kernel circuits’ nullifier non-existence checks. |
| The script uses SHA-256 and small integers; Aztec uses Poseidon2 over BN254 with domain separators for inner nodes. | The digests differ; the logic of the checks is the same. | nullifier_merkle_hash and NullifierLeafPreimage::hash in the protocol circuits. |
Only the Noir protocol circuits and barretenberg’s tree initialisation were read; the AVM’s own checks (indexed_tree_check.cpp) were not reviewed. |
Public execution may check low leaves through another path. | barretenberg/cpp/src/barretenberg/vm2/simulation/gadgets/indexed_tree_check.cpp and its constraints. |
| The Aztec documentation page was read in a copy dated 2 September 2026. | A later version may change the numbers or the pseudocode. | The live page linked in References. |
| Verdict’s capacity doubling is summarised from section III, and Phalanx from the abstract and the start of section IV. | Their costs in a full system are not covered. | Sections IV and VI (experimental evaluation) of the Verdict paper. |
References
- R. Dahlberg, T. Pulls and R. Peeters, Efficient Sparse Merkle Trees: Caching Strategies and Secure (Non-)Membership Proofs, IACR ePrint 2016/683, 2016: section 3 for the definition, default digests and history independence, section 4 for caching and compressed proofs, section 5.2 for the encoding.
- I. Tzialla, A. Kothapalli, B. Parno and S. Setty, Transparency Dictionaries with Succinct Proofs of Correct Operation, the Verdict paper, IACR ePrint 2021/1263, 2021: section III (indexed Merkle trees).
- Aztec, Indexed Merkle Tree (Nullifier Tree), developer documentation, copy of 2 September 2026.
- AztecProtocol, aztec-packages at commit
e8e646592fead7353ba553f7ba62f4372ea6928b(10 September 2026), protocol circuits innoir-projects/fnd/noir-protocol-circuits/crates/types/src/:merkle_tree/indexed_tree.nr(batch_insert_no_update, empty-low-leaf assertion at line 62);merkle_tree/indexed_tree/low_leaf.nr(is_valid_low_leafand its tests);merkle_tree/membership.nr(check_non_membershipat line 70,conditionally_check_membership);abis/nullifier_leaf_preimage.nr(leaf layout, empty hash,points_to_infinity);data/storage_read.nr(public data reads);constants.nr(tree heights, lines 38-40);- and
barretenberg/cpp/src/barretenberg/crypto/merkle_tree/indexed_tree/content_addressed_indexed_tree.hpp(genesis padding leaves).
- Verification code:
nonmembership.pyand its output in the verification directory (25 checks, Python standard library).
Related articles
- Auditing Merkle Proofs in Solidity - How Airdrops and Bridges Accept Forged Claims
- How Certificate Transparency and Sigstore Keep a Log Honest
- Reading Ethereum State Without Trusting the RPC - eth_getProof Step by Step
- How Aztec Works — Private Execution, Notes and Nullifiers
- Poseidon Hash Function - Overview
- Zero-Knowledge Proof Vulnerabilities — A Technical Classification
- Merkle Patricia Forestry on Cardano