DocsThe proof

DocsConcepts9 of 33 · 3 min read

The proof

What a payment's zero-knowledge proof states, what it is tied to, and how the program checks it.

Every payment and every withdrawal carries a proof that the program verifies before it moves anything. With it the chain enforces the whitelist without learning who was paid.

#What a payment proves

The sender proves, without showing any of the private values, that all of this holds at once:

  1. The notes are theirs to spend

    They know the secret key of every owner key whose notes the payment spends.

  2. The recipient is whitelisted

    There is a meta-address (S, V) whose leaf is in the whitelist tree, under the root the payment names.

  3. The stealth address belongs to that recipient

    The announced stealth address, ephemeral key and view tag were derived from that same (S, V).

  4. The auditor can read that recipient

    The announced ciphertext encrypts that same S under the auditor's public key.

  5. It is this transaction

    All of the above is tied to this exact transfer: its notes, its outputs, its fees and the accounts it touches.

The verifier learns that such an (S, V) exists and learns nothing about which one. The leaf, its index and its path are private inputs.

A withdrawal proves the first and the last of these, with the destination wallet and the amount as part of the transaction it is tied to.

#One statement

All of it is folded into a single number, the statement, which is the proof's only public input. The program computes the statement itself from what it can see:

Comes fromGoes into the statement
The instructionThe announcement, the owner keys, the forwarded Rings instruction
The accountsEvery address the Rings call touches, the destination
The configurationThe auditor key, the fee recipient, the relayer, both fees

Then it verifies the proof against that number. If the sender announced one thing and proved another, the two statements differ and verification fails with InvalidProof. The same happens if anyone alters the transaction after it was proved.

The exact construction is on Circuits.

#Two proofs in one transaction

A payment carries two proofs. The Rings proof, checked by the Solana Privacy Program, shows that the notes exist, that they are unspent, and that the amounts balance. Liora's proof shows who may spend them and that the recipient is whitelisted and auditable.

Rings proofLiora proof
Checked byThe Solana Privacy ProgramThe Liora program
ShowsNotes exist and are unspent, amounts balanceOwnership, whitelist membership, stealth derivation, audit ciphertext
Sees the amountYes, privatelyNo

Liora's statement includes the bytes of the Rings instruction, so the two proofs cannot be separated or recombined.

#Proof system

Liora's proofs are Groth16 on BN254, the same family as Rings' own. A proof is 128 bytes whatever the size of the whitelist. The program verifies it through Solana's alt_bn128 syscalls.

The keys, the hashes and the encryption all live on Baby Jubjub and Poseidon because both are cheap to compute inside a BN254 proof.

The sender's device makes the proof. The private inputs, including which recipient was chosen, never leave it. How long that takes and what verification costs on chain are on Measured figures.

#What a failed proof looks like

SituationOutcome
The recipient is not in the directory snapshotThe device stops before proving: NOT_WHITELISTED
The whitelist changed after the proof was made, by an admissionThe payment goes through: the earlier root is still accepted
The recipient was removed after the proof was madeThe program rejects it: RootExpired
The transaction was altered after provingThe program rejects it: InvalidProof
The roles or fees changed after provingThe program rejects it: InvalidProof. Make the payment again