Back to audren.xyz

Protocol Specification · Version 1

Cryptographic & On-Chain Specification

Exact wire formats, Multi-Base Binary Triptych verification equations, Structure-of-Arrays byte offsets, and measured sBPFv3 Compute Units implemented in github.com/audren-xyz/audren and deployed at AUDRBK6kVkQoEGm3EB7swd34SUPqrHZeNEkB5vZWVSv3.

1. Instruction Set (11 Instructions)

TagInstructionBehavior & Invariants
0x00InitPoolCreate PoolState (192 B), EpochPage #0 (6,240 B < 10 KiB CPI cap), sol_vault, and page_rent_vault.
0x01OpenPagePermissionless rollover sealing current EpochPage and opening page_id + 1 funded by PageRentVault via live Rent::get().
0x02DepositShield Native SOL, Classic SPL, or safe Token-2022 directly to any Audren stealth address (zero spend key or ZK proof required).
0x03TransferPrivate multi-asset 1-in → 2-out transfer: Triptych (m=5/6/7), CrossBase2 (256 B, unlinkable asset tags), Agave Bulletproof U128, optional AuditorAssetProof.
0x04MergeConsolidate two same-asset shielded notes via 2 Triptych proofs + CrossBase1 (128 B) + Agave Bulletproof U64.
0x05SwapViaRouterNon-custodial 1-tx private DEX swap through 16 sharded swap_escrow PDAs into any external Solana router (Jupiter, Orca, Raydium, Meteora, Phoenix, etc.).
0x06WithdrawUnshield exact amount to any recipient wallet/ATA with optional shielded change note.
0x07SetPausedEmergency authority circuit breaker for deposits/transfers/swaps (never grants vault withdrawal custody).
0x08WriteProofBufferUpload parallel out-of-order <= 768 B payload chunks into an ephemeral ProofBuffer PDA tracked via u16 bitmask (strict <= 1,232 B Solana MTU).
0x09ExecBufferedZero-copy execute Transfer, Merge, SwapViaRouter, or Withdraw from a completed ProofBuffer and atomically refund 100% of buffer rent to payer.
0x0ACloseProofBufferReclaim 100% of rent lamports from an abandoned or unexecuted ProofBuffer back to its authority.

2. Structure-of-Arrays EpochPage (6,240 B)

Every EpochPage PDA (["audren_page", pool_id_le, page_id_le]) holds up to 32 notes in column-major order, strictly under Solana’s 10 KiB CPI allocation cap. Standard RPC getMultipleAccounts and Agave programSubscribe pass dataSlice: { offset: 64, length: 1056 } to scan 3,200 notes in ~106 KB.

OffsetSizeSliceRole
0..6464 BPageHeaderAUDRNPG1 magic, version, bump, closed flag, count (0..=32), pool_id, page_id, slots
64..9632 Bview_tags[32]1-byte fast scan filter (included in RPC & WS dataSlice)
96..1,1201,024 Bephemeral_pks[32]Stealth ECDH R_k points (included in dataSlice → 1,056 B total)
1,120..2,1441,024 Bstealth_pks[32]One-time spend keys P_k read zero-copy under Direct Mapping (SIMD-0460)
2,144..3,1681,024 Basset_tags[32]Re-randomized hidden asset commitments A_k = G_mint + a·H
3,168..4,1921,024 Bcommitments[32]Pedersen value commitments V_k = v·A_k + r·H
4,192..6,2402,048 Bciphertexts[32]AES-256-GCM note memos (48 B payload + 16 B authentication tag)

3. Multi-Base Binary Triptych Verification Equations

For ring size N = 2ᵐ (m = 5: 32 notes; m = 6: 64 notes; m = 7: 128 notes), random Fiat-Shamir weights μ₂..μ₇ batch all equations into chunked 8 KiB invocations of Agave’s native sol_curve_multiscalar_mul syscall inside Solana’s default 32 KiB heap.

EqPropertyVerification Equation
Eq 1Bit linearityA + ξ·B − Σ fⱼ·Hⱼ − z_A·H = 0
Eq 2Bit booleanity (lⱼ ∈ {0,1})ξ·C + D − Σ fⱼ(ξ − fⱼ)·Hⱼ − z_C·H = 0
Eq 3Stealth ownership (Pₗ = x·G)Σ pₖ(ξ)·Pₖ − Σ ξʲ·Xⱼ − z_x·G = 0
Eq 4Unique nullifier (x·J = U)ξᵐ·U − Σ ξʲ·Yⱼ − z_x·J = 0
Eq 5Multi-asset & value balanceΣ pₖ(ξ)·(Aₖ + α·Vₖ) − ξᵐ·(A_spend + α·V_spend) − Σ ξʲ·Wⱼ − z_q·H = 0
Eq 6Audited ElGamal S₁ = rₛ·Gξᵐ·S₁ − Σ ξʲ·Tⱼ − z_aud·G = 0 (InstitutionalAudited)
Eq 7Audited ElGamal S₂ = Pₗ + rₛ·K_audξᵐ·S₂ − Σ pₖ(ξ)·Pₖ − Σ ξʲ·Eⱼ − z_aud·K_aud = 0 (InstitutionalAudited)

4. Measured sBPFv3 Compute Units

Measured directly on the deployed 274,672-byte sBPFv3 ELF (SHA-256 3a4b8b2a53dd5c97…) with radix-29 scalar arithmetic and Agave native Ristretto255 + ZkElGamal Proof syscalls.

InstructionMeasured CUNotes
Deposit (Tag 2)19,030 CUNative SOL, SPL, or safe Token-2022 · 0 ZK proof
Withdraw full (Tag 6)237,386 CUUnshield with optional shielded change note
SwapViaRouter (Tag 5)405,291 CUIsolated swap_escrow CPI · leaves ~995k CU for DEX
Transfer m=5 (32 ring)451,591 CUMulti-Base Triptych + Agave Bulletproof U128
Transfer audited (m=5)506,766 CUEnforces ElGamal (S₁,S₂) + (M₁,M₂) to K_aud
Merge 2→1 (Tag 4)573,054 CUTwo m=5 proofs consolidated into 1 output note
Transfer m=6 (64 ring)824,512 CU2 EpochPages · chunked 8 KiB MSM buffer
Transfer m=7 (128 ring)1,113,133 CU4 EpochPages inside default 32 KiB Solana heap