Sharded Trees
The ShardedTreeRegistry manages 16 parallel Merkle trees, enabling 16x throughput compared to a single tree.
Architecture
ShardedTreeRegistry
├── Shard 0 → Merkle Tree (depth 20)
├── Shard 1 → Merkle Tree (depth 20)
├── ...
└── Shard 15 → Merkle Tree (depth 20)
Each shard is an independent CommitmentTree with its own root, capacity (~1M leaves), and root history.
Shard assignment
shard = uint256(commitment) % 16
Deterministic: the same commitment always maps to the same shard.
Proof generation
When generating a proof for a sharded commitment:
- Identify the shard:
shard = commitment % 16 - Get the shard's current root
- Build the Merkle proof within that shard's tree
- Generate the Groth16 proof as normal
The proof format is identical — the only difference is which root is used.
Trade-off: anonymity set
Each shard has approximately 1/16th of the total commitments. This means the anonymity set per shard is smaller than the unified tree. For privacy-sensitive applications where anonymity set size is critical, use the standard single-tree CommitRevealVault.
Capacity
| Configuration | Total capacity |
|---|---|
| Single tree | ~1,048,576 commitments |
| 16 shards | ~16,777,216 commitments |