This page describes the cryptographic core: what a note is, how it is spent, what the circuit proves, how the proof is checked on chain and how your wallet finds the notes that belong to it.
One pool for every token
All deposited tokens sit in one contract, SottoVault. Inside it, value exists only as notes. The token is a private field of each note, so all users of all tokens share one anonymity set: a private send of a meme coin looks exactly like a private send of USDC.
Notes and commitments
A note is four values:
| Field | Meaning |
|---|---|
amount |
how much, in the token's base units (at most 248 bits) |
pubkey |
the owner's note public key |
blinding |
a random value that makes every commitment unique |
asset |
the token address |
The pool never stores the note itself, only its commitment:
pubkey = Poseidon(privKey)
commitment = P2(amount, pubkey, P2(blinding, asset))
P2 is the Poseidon2 hash (Barretenberg's permutation, width 4); Poseidon is the circomlib Poseidon, used only for the note key so that sotto1… addresses stay stable. Without the blinding and the key, a commitment reveals nothing about the amount, the owner or the token.
Keys
Everything derives from your recovery phrase:
- your public EVM account:
m/44'/60'/0'/0/i; - a private seed per account:
keccak256("sotto/seed/mnemonic/v1" ‖ BIP39 seed); - a spending key (
keccak256("sotto/spend/v1" ‖ seed) mod p), whose Poseidon hash is your note public key; - a viewing key (
keccak256("sotto/view/v1" ‖ seed)), used as an x25519 secret, one half of decrypting notes sent to you; - an ML-KEM-768 key pair (NIST FIPS 203) from
HKDF-SHA256(seed, "sotto/pq-kem/v1"), the post-quantum half; - a self-note key (
HKDF-SHA256(seed, "sotto/self-note/v1"), 256 bits), which encrypts the notes you make for yourself; - one-time note keys
Poseidon(spendingKey, i)with a random indexi, used for deposits, swap outputs and other notes that should not share your main key.
Your shielded address is sotto1 followed by 192 hex characters (198 in all): your note public key, your x25519 encryption key and the SHA3-256 fingerprint of your ML-KEM-768 public key. It is what others need to send you a note. All of these keys are restored from your recovery phrase. See Quantum resistance.
Nullifiers: spending without saying which note
Spending a note publishes its nullifier:
signature = P2(privKey, commitment, pathIndex)
nullifier = P2(commitment, pathIndex, signature)
Only the owner can compute it (it needs privKey), and nobody can tell which commitment it belongs to. The pool stores every spent nullifier, so a note can be spent only once.
The Merkle tree
Every commitment is a leaf of one append-only Poseidon2 Merkle tree of depth 32 (2^32 leaves). Empty leaves use the fixed zero value keccak256("tornado") mod p.
- Each transaction appends its three outputs plus one unspendable padding leaf in a single update, so it creates one new root. A swap appends its shielded output as well.
- The pool remembers the last 4,096 roots, with an O(1) lookup. A proof may be built against any of them, so a proof prepared in advance — a trade ticket, a prepared swap — stays valid while others transact. The wallet re-proves well before a root falls out of the history.
- The contract computes the same Poseidon2 as the circuit, so a deposit can create its commitment on chain.
The JoinSplit circuit
Every spend — send, swap, withdrawal, adapter call — is one JoinSplit proof. The circuit (Noir 1.0.0, about 13,000 gates, 2^14 rows) spends up to two main notes and one gas note, and creates two main outputs and one gas change note. Zero-amount inputs are dummies that need no Merkle path, so a transaction can spend one real note or two.
The circuit enforces:
- each non-zero input note is in the tree under the given
root, and its nullifier is computed correctly; - the three nullifiers are distinct;
- each output commitment is computed correctly and each amount fits in 248 bits;
- main group:
sum(inputs) + public_amount = sum(outputs), all in one privateasset; when value enters or leaves, that asset must equal the publicpublic_asset; - gas group:
gas input = gas_fee + gas change, ingas_asset, with the change range-checked so the fee can never exceed the gas note.
The separate gas note is what keeps a private send's token hidden: the relayer is paid from the gas note (usually WHYPE), so the main token never has to appear.
Public inputs
Twelve field elements are public; everything else is private to your device.
| # | Input | Meaning |
|---|---|---|
| 0 | root |
a recent root of the tree (one of the last 4,096) |
| 1 | public_amount |
value entering (positive), leaving (negative) or 0 for a private send |
| 2 | public_asset |
the token of that public amount; 0 for a hidden-token send |
| 3 | gas_fee |
the relayer fee paid from the gas note |
| 4 | gas_asset |
the token of the gas note |
| 5 | ext_data_hash |
binds every external field of the transaction (see below) |
| 6–8 | input_nullifier[3] |
nullifiers of the two main inputs and the gas input |
| 9–11 | output_commitment[3] |
commitments of the two main outputs and the gas change |
UltraHonk on your device, no trusted setup
Proofs use UltraHonk (Barretenberg / bb.js 6.0.0) with a keccak transcript, in zero-knowledge mode. UltraHonk uses a universal BN254 reference string, so there is no per-circuit trusted setup and no ceremony whose secrets could forge proofs.
The proof is generated on your device — in the extension or in the in-site wallet's worker. Your notes and keys never leave it. A proof is 8,000 bytes. Wallets prove while you fill in a form, so the proof is usually ready before you click.
Verification on chain
SottoVault rebuilds the public inputs from the transaction itself (root, public amount and asset, gas fee and asset, extDataHash, nullifiers, commitments), rejects any value that is not a canonical field element, and calls the verifier. An invalid proof reverts the transaction.
Two verifiers of the same verification key are fixed in the vault at deployment:
VaultHonkVerifierOpt— the active one: the generated verifier with its field inversions batched into one modular exponentiation. It accepts and rejects exactly the same proofs and costs less gas.VaultHonkVerifier— the verifier exactly as Barretenberg generates it, kept as a fallback.
Both are immutable in the vault; no function can set any other verifier. Addresses are on Contracts.
extDataHash: what the relayer cannot change
Everything about a transaction that is not inside the circuit is collected in a struct, ExtData: the recipient, the external amount and token, the relayer and both fees, the three encrypted outputs and the adapter's instructions. Its hash is a public input:
extDataHash = keccak256(abi.encode(ExtData)) mod p
Because the proof commits to this hash, the relayer — or anyone who sees the transaction before it lands — can only submit it exactly as your wallet built it. It cannot change the recipient, raise its fee, redirect a swap's output or alter an adapter order. Any change makes the proof invalid.
Encrypted outputs: how your wallet finds its notes
Each new note is published with an encrypted output of exactly 1,224 bytes, so its owner can learn the note's contents (version, amount, blinding, one-time key index and token). Every output has this size, whoever it is for, so a payment can't be told from change, a merge or a deposit:
- To another person (hybrid): an ephemeral x25519 key agreement with the recipient's viewing key and an ML-KEM-768 encapsulation to the recipient's ML-KEM key. Key and nonce =
HKDF-SHA256(x25519 secret ‖ ML-KEM secret), bound to both public keys and the ciphertext; cipher XChaCha20-Poly1305. Reading it needs both secrets, so it stays private while either x25519 or ML-KEM-768 holds. - To yourself (deposits, change, the gas note, swap outputs): encrypted with your self-note key. There is no public-key step; the x25519 and ML-KEM fields are filled with real values for keys nobody holds, so the output looks like any other.
- Dummy outputs are hybrid encryptions to keys nobody holds.
- Layout:
0x02(1) ‖ x25519 public key (32) ‖ ML-KEM-768 ciphertext (1,088) ‖ ciphertext (87) ‖ tag (16).
The sender gets your ML-KEM key from your payment link, or from the public key directory on the indexer, and checks it against the fingerprint in your address, so the directory can't swap it. Your wallet publishes its key there when it starts, over HTTP, never in a transaction. Notes written before this format (159 bytes, x25519 only) are still read.
Your wallet finds its notes by itself. It downloads every leaf and every spent nullifier of the pool from the public indexer — the same data for everyone, with no account, key or address in the request — and tries to decrypt each new leaf with your keys. Spent status is checked locally against the nullifier list. Nothing on the server knows which notes are yours.
To start fast, the wallet keeps an encrypted sync cache on your device (XChaCha20-Poly1305 under a key derived from your viewing key) and an incremental copy of the tree, verified against the chain on load. A new session only fetches what is new.
Batch lane
The repository also contains an aggregation circuit that verifies several vault proofs in one recursive proof (transactBatch). It is not enabled in the current deployment.
Further reading
- Relayer: who submits your proof and what it sees.
- Privacy model: exactly what is public.
- Contracts: addresses and build settings.