Skip to content

How the note and proof work ​

You can finish the book without this page. It is here so the same transfer can be checked against the mechanism, in one sitting, before the risks.

The note, the commitment, and the nullifier ​

A current note string is vx2-<amountHex>-<privateKeyHex>-<blindingHex>[-<mint>]. The amount is an integer in base units. SOL omits the mint suffix. The spending key and the blinding are secret random field elements. The spending key is not a Solana wallet key. Its public key is Poseidon(privateKey).

The commitment is Poseidon(amount, publicKey, blinding, mintField). The mint field is zero for SOL. For a token, it is the first 31 bytes of the mint address, read as a field element. The commitment does not contain the leaf index. Equal amounts still produce different commitments because of the blinding.

Once the commitment is in the tree at index i, the nullifier is Poseidon(commitment, i, Poseidon(privateKey, commitment, i)). The nullifier is public when the note is spent. It prevents a second withdrawal. By itself, it does not show which commitment was spent. Anyone with the complete note string should be treated as able to attempt a withdrawal.

Notes from the older fixed-denomination format are not spendable on the current program.

The tree and the proof ​

Each asset has a Poseidon Merkle tree of height 26, up to 2^26 leaves. Empty nodes use fixed zero values. A parent is Poseidon(left, right). The program accepts the latest 100 roots. A client rebuilds the tree from indexed leaves, finds its commitment, and gives the leaf index and the Merkle path to the prover as private witness data. The root is public. A root outside the window is rejected.

The circuit is Groth16 with two inputs and two outputs. It checks that real notes open correctly and sit on a path to the public root, that nullifiers match, that output commitments match, that value is conserved, and that an external-data hash binds the transaction. Unused slots are zero notes. A deposit uses two empty inputs and creates one real note plus an empty output. A full withdrawal can omit change. A partial withdrawal creates change. Proving takes a few seconds on a normal device, depending on the device and the build.

A withdrawal, a swap, and a bridge spend one real note per proof. A private payment can spend two notes in one proof. The same kind of payment, made to your own private address, combines two notes into one.

Public inputs are the Merkle root, a signed public amount (positive on deposit, negative on withdrawal), the external-data hash, the mint field, two input nullifiers, and two output commitments. Private witness data includes input amounts, keys, blindings, indexes, and paths, plus output amounts, public keys, and blindings. The external hash binds the recipient, the relayer, the fee, the mint, the public amount, and the encrypted output bytes. The program recomputes it. The documented construction is SHA-256 with the first byte cleared so the digest fits the BN254 field. Verify that against the deployed program and circuit before you rely on the byte layout.

What a deposit and a withdrawal record ​

A deposit has two empty inputs, a positive public amount, and a new commitment. Alice signs and transfers the asset to the treasury. Her address, the asset, and the incoming amount are public. Deposits above the tree cap are rejected. Token-2022 mints that charge a transfer fee are unsupported, because the balance received would differ from the note amount.

A withdrawal spends one real note. The client finds the leaf index, checks that the nullifier is unused, chooses a full or partial amount, retrieves fees, proves, and sends the payload to a relayer. Address B receives the withdrawal amount minus fees. The program rejects an invalid proof, an unknown root, a reused nullifier, and a fee or public input that does not match.

The program emits NewCommitment for every leaf, including encrypted output bytes, Deposit with the public incoming amount, Withdrawal with the public amount, recipient, relayer, and fee, PrivateSwap for a swap, Bridge for a bridge, PrivatePay for a private payment, Collect for a mining collect, and EpochRolled when a mining day closes. The events are recorded through a self-call, so a long log cannot hide a leaf from the indexer.

Swaps, bridges, and payments use the same circuit ​

A private swap, a private bridge, and a private payment are spends. They use the same two-input, two-output circuit as a withdrawal, with a negative public amount on the tree they spend from. For a payment, that amount is only its flat fee. A mining collect has a circuit of its own. What changes is the external-data hash. Each job hashes its own fields under its own domain tag, so a proof made for one job can never be replayed as another:

JobDomain tagFields bound into the proof
WithdrawalNone (the original layout)Recipient, relayer, fee, amount, mint, encrypted outputs
Private swapveilix:swap:v1Both mints, the amount in, the fee, the minimum out, the relayer, the one-time public key and blinding of the new note, encrypted outputs
Private bridge of SOLveilix:bridge:wtt:v1The mint, the relayer, the fee, the amount, the destination chain, the recipient, the gas drop-off, encrypted outputs
Private bridge of USDCveilix:bridge:cctp:v1The same fields, for the CCTP route
Private paymentveilix:pay:v1The mint, the relayer, the fee, both encrypted outputs
Mining collect, with its own circuitveilix:collect:v1The pool’s mint, the reward mint, the relayer, the fee, four encrypted outputs

A swap’s new note cannot be committed in the proof, because nobody knows the exact output until the trade runs. The proof fixes its one-time public key and blinding instead, and the program computes Poseidon(amount out, public key, blinding, mint) from the real output.

The indexer’s part ​

The devnet indexer at https://api3.veilixprotocol.com serves roots and leaves, lists relayers, signs deposit screening passes, and queues Private Send batches. Fee quotes come from the relayers. The indexer is a convenience. Stale data can delay a user. The program still validates the root and the proof.

To check a note, the client downloads the full leaf list and reads the full set of nullifier accounts from Solana, then matches locally. It does not send the note’s commitment or nullifier anywhere, except for a compliance report that the user asks for.

The sealed backup ​

The SDK can encrypt note data into at most 256 bytes of ciphertext, stored beside a commitment and not inside it. The key is the first 32 bytes of a hash of a wallet signature over the notes-key message. It is a Sign In With Solana message that names the account and the official site, devnet.veilixprotocol.com or veilixprotocol.com on mainnet, so wallets that check such messages warn when another site asks for it. It has no nonce or time, so the same account always gets the same key. Notes sealed before 19 November 2026 used the older message veilix:notes:v1, which names no site, and a scan can use that key as well. A deposit usually stores one encrypted output. A partial withdrawal can seal the change note when the wallet key is loaded. A scan can find sealed notes, including spent ones. An unsealed file cannot be recovered by the scan.

The next page is the risk list, and then the close of the story.