The person tree
One leaf per enrollment, the roots a claim may prove against, and paths built on the device.
The person tree holds one leaf per enrollment. A claim proves that the claimant's leaf is in the tree without saying which leaf, so a claim can't be traced to the wallet that enrolled.
The leaf
Each leaf is Poseidon(s, k, expiry): the person secret s from the threshold OPRF, the place secret k the device derives from the wallet's unlock signature, and the credential's valid-until time. Opening the leaf in a claim needs both secrets, so a person needs both their person secret and their wallet to claim, and the leaf on chain reveals neither.
Shape
The tree is an append-only Poseidon Merkle tree of depth 20, with room for 1,048,576 leaves. An empty leaf is zero, and each empty subtree hashes the one below it with itself. The program stores it in one account at ["tree"] that keeps only what appending needs: the frontier of the last left node at each level, the empty-subtree hashes, the index of the next leaf and a ring of the last 64 roots. When the tree is full, enroll refuses with TreeFull.
Roots and their history
Each enrollment appends a leaf and each revocation replaces one with zero, and both record a new root. A claim names the root it proved against, and the program accepts it if that root is any of the last 64. A device can prove against the root it downloaded and still claim after other people have enrolled; once 64 newer roots have been recorded, the claim fails with RootUnknown and the device rebuilds its path against a current root.
A revocation never clears the history, so no claim already in flight is thrown away by someone else's revoke. The revoked leaf stops being provable when the last root that contains it rolls out of the history.
Building a path
The API never serves a Merkle path by leaf index, because asking for one would point at the asker's leaf. The device downloads every leaf instead, in index order, and builds its own path:
$ curl "$ONCE_API/v1/tree/leaves?from=0&limit=4096"Each page carries the root of the snapshot it came from. The device keeps fetching from page.nextCursor until it is null, and starts over if the root changes during the download. Revoked leaves come back as zero, which is what the tree holds at those indices.
The same leaf list can be rebuilt from the program's events alone: replay Enrolled(index, leaf, root) and Revoked(index, root) in chain order. Events lists their fields.