Testnet only. Sei Atlantic-2, chain 1328.Not audited. Test funds only.

Protocol

Circuit and public inputs

The join-split statement and its twelve public inputs.

On this page
  1. What it proves
  2. Public inputs, in order
  3. By transaction kind
  4. Known gaps

packages/circuits/circuits/joinsplit.circom, JoinSplit(20): 22,292 non-linear constraints, 12 public inputs, Groth16 over BN254, circom 2.1.9, snarkjs 0.7.4.

What it proves

  1. Every amount and the fee is below 2^96, and |extAmount| < 2^96.
  2. One private tokenId matches all four notes. It is not a public input.
  3. The public asset rule:
    isNone = (publicAssetId == 0)
    isNone * extAmount == 0
    isNone * fee       == 0
    (1 - isNone) * (tokenId - publicAssetId) == 0
    
  4. in0 + in1 + extAmount == out0 + out1 + fee.
  5. Each non-zero input has a valid path to root and to aspRoot.
  6. nf_i == H(TAG_NULLIFIER, cm_i, leafIndex_i, spendKey_i) and nf_0 ≠ nf_1.
  7. outCm_j == H(TAG_COMMITMENT, tokenId, outAmount_j, outOwnerPub_j, outBlinding_j).
  8. chainId, pool and extDataHash are bound as public inputs.

Public inputs, in order

# Name Source
0 root calldata; must be a known root
1 aspRoot calldata; must be a known root
2–3 nullifier0, nullifier1 calldata; unspent and distinct
4–5 commitment0, commitment1 calldata
6 extAmount signed, field-encoded as `x ≥ 0 ? x : r −
7 fee < 2^96
8 publicAssetId 0 (private) or 1/2
9 chainId block.chainid, never calldata
10 pool address(this), never calldata
11 extDataHash keccak256(abi.encode(recipient, relayer, enc0, enc1)) mod r

Every value is checked < r before verification.

By transaction kind

Kind publicAssetId extAmount fee recipient relayer
Deposit 1 or 2 > 0 0 0 0
Transfer / claim 0 0 0 0 any
Withdrawal 1 or 2 < 0 ≥ 0 ≠ 0 ≠ 0 if fee > 0

Known gaps

  • There is no in0 + in1 > 0 constraint, so a zero-value transfer can be proven without funds. The relayer's limits are the defence (Spec §17).
  • Ciphertext correctness isn't proven in the circuit. The sender's client checks it (Note encryption).
  • An independent circuit review hasn't happened. circomspect has been run.

Source: apps/web/content/docs/circuit.md