Spring
WhitepaperGitHubLaunch app

Docs / How it works

Architecture

Spring has four moving parts: one Solana program, the production withdrawal circuit, set providers, and the user's browser. An optional relayer submits withdrawals for users who want a fresh address with no SOL in it.

The program

An Anchor program with one pool account, found at the PDA seeds ["pool"].

AccountSeedsSizeHolds
Pool["pool"]3,288 bytesTree size and depth, the 33 side nodes of the incremental tree, the last 64 roots, fee settings, balances
AspProvider["asp", authority]154 bytesA provider's current and previous root, the slot it was published, a hash of the set's contents, a retired flag
Nullifier["nullifier", nullifier_hash]8 bytesNothing; its existence marks a spent note

The state tree is a lean incremental Merkle tree hashed with the Solana Poseidon syscall (BN254, x5). Depth grows with the number of leaves, up to 32.

The circuit

Spring proves against the open-source production Privacy Pools withdrawal circuit and its published trusted-setup keys (privacy-pools-core on GitHub). At depth 32 it has 36,832 constraints and 8 public signals:

SignalMeaning
newCommitmentThe change note, inserted into the tree
nullifierHashMarks the spent note
withdrawnValueLamports leaving the pool
stateRoot, stateTreeDepthA recent root of the deposit tree
ASPRoot, ASPTreeDepthThe association-set root used
contextHash binding pool, submitter, recipient, fee recipient and relayer fee

The verifier

Verification uses the alt_bn128 addition, multiplication and pairing syscalls. The proof travels as 256 bytes: A negated, B, C, big-endian. We measured our verifier at 115,113 compute units, 8% of a transaction's budget, and a proof with one flipped bit is rejected.

Set providers

A provider is a key registered by the pool owner. It publishes roots; it holds no funds and cannot move any. Retiring a provider is one-way, so a provider's name can never be reused for a different list.

Sequence of one withdrawal

Browser   reads the tree and the chosen set, builds the witness
Browser   builds the Groth16 proof (about 1.35 s on a laptop)
Browser   hands proof + public signals to a relayer, or submits itself
Program   checks: state root known, set root current, proof valid, nullifier new
Program   pays the recipient and the relayer fee, inserts the change note