audren.xyz

Build your own way in.

No Audren account, API gate, or mandatory indexer. Call the program directly via its published Codama and Anchor IDLs, or use four optional Apache-2.0 SDKs (Rust, TypeScript with WASM Groth16 prover, Swift for iOS, and Kotlin for Android), verified byte-for-byte against spec/test-vectors.json on every CI run.

Program ID (v1.6.0)AUDRBK6kVkQo…ZWVSv3
4 standardized SDKsRust · TypeScript · Swift · Kotlin
Conformance and licensespec/test-vectors.json · Apache-2.0

Zero-indexer integration with explicit responsibilities.

Ordinary Solana RPC keeps infrastructure minimal, while wallet recovery, encrypted local persistence, confirmation handling, and privacy disclosures remain core application responsibilities.

End-to-end client integration pipeline
Ordinary Solana RPC · Local Groth16 proving · Optional Gateway
  1. Reads whole pages over ordinary RPC1. SyncCompactWalletStoregetMultipleAccounts RPCFreeze sealed siblings, drop pages~1.28 MB kept @ 10M notes
  2. Nothing leaves the device2. ProveBN254 Groth16 locally17,861 R1CS · 192 B proofBind ctx_hash and router accountsspend_sk stays on device
  3. Sends 1 transaction with a 192 B proof3. SubmitOne transactionGateway / Tx v1 client: 0x81 (4,096 B)Browser wallet: v0 + Auto-OpenPage75k–285k CU tight budgets
  4. Reads the confirmation and new pages4. SettleConfirm and verifyNullifierPage marks spendsMode 1 receipt · Mode 2 FVK · Mode 3 holdingsEncrypted seed backup

Sync: your app pulls public pages with getMultipleAccounts and keeps its own notes plus compact tree hashes, about 1.28 MB even at 10M pool notes, and drops the raw pages.

Four standardized SDKs with zero cryptographic drift.

Rust, TypeScript (+ WASM), Swift, and Kotlin share the exact same Circom BN254 Poseidon parameters, 17,861-R1CS Groth16 circuit, versioned 72 B ChaCha20-Poly1305 AEAD memos (106 B SoA wire entries), BIP-350 Bech32m aud1… addresses, and 14 canonical audren_* PDAs, verified byte-for-byte in CI against spec/test-vectors.json.

Rust · Services and CLIs

crates/client & crates/audren-circuits

Canonical native proving client, frozen R1CS circuit, and zero-indexer CompactWalletStore. Pin directly via git in Cargo.toml.

  • HKDF-SHA256 spend and view keys (Poseidon spend_pk and nk, X25519 view key), sub-accounts & read-only FVK
  • Native BN254 Groth16 proving over the 4-ary depth-20 global pool
  • All 10 instruction builders + exact ctx_hash transcripts
  • Full LiteSVM & adversarial DeFi regression test suite included
  • Not on crates.io yet: add audren-client as a git dependency pinned to a release tag, plus solana-address
TypeScript · Web, Node 22+, and Workers

@audren-xyz/sdk + @audren-xyz/sdk/prover

Zero-WASM pure-TS root entrypoint (runs natively in Cloudflare Workers) paired with the exact Rust-compiled audren_circuits.wasm Groth16 prover.

  • @audren-xyz/sdk: zero-WASM pure-TS BN254 Poseidon, ChaCha20-Poly1305 AEAD (+ PQ self-memos), BIP-350 Bech32m aud1…, 14 PDAs, CompactWalletStore, Mode 3 live ZK holdings verifier (@noble/curves/bn254), Transaction v1, AudrenSwapRouter (Jupiter, DFlow, OKX, Titan, Bedrock, bloXroute + auto best-price racing) & optional AudrenGatewayClient (IDLs on @audren-xyz/sdk/idl)
  • @audren-xyz/sdk/prover: the Rust prover compiled to audren_circuits.wasm, producing the same 192 B proof as native Rust for the same witness and seed
  • Published on npm: install with pnpm add @audren-xyz/sdk@1.6.5 (upgrade anytime via pnpm update @audren-xyz/sdk --latest)
  • Cross-SDK LiteSVM tests verify TS WASM proofs directly on sBPFv3 audren.so
Swift · iOS 15+ and macOS 13+

packages/swift (AudrenSDK)

Native Swift Package generated via UniFFI directly over crates/audren-ffi so iOS wallets inherit the exact Rust Groth16 prover with zero re-implementation drift.

  • Native local BN254 Groth16 proving on Apple Silicon & iPhone ARM64
  • 86 zero-panic UniFFI exports (71 fallible + 15 infallible): keys, FVK, 14 PDAs, 106 B X25519 + PQ self-memo & AUD1RFD1 decryption, coin-selection / planMultiNoteSpendFfi, Token-2022 helpers, Mode 1 receipt, native 1-call Mode 3 ZK holdings proving & verification (proveThresholdBalanceFromStoreFfi, deriveGatewayHoldingsChallengeFfi) & 10 ix builders
  • Build the XCFramework locally with scripts/build-mobile-sdks.sh ios; no remote SwiftPM release yet
  • Verified in CI via swift test against spec/test-vectors.json
Kotlin · Android API 24+ and JVM 21+

packages/kotlin (xyz.audren.sdk)

Native Kotlin SDK generated via UniFFI + JNA over crates/audren-ffi for Android wallets and JVM backend services.

  • Native local BN254 Groth16 proving on Android ARM64 / x86_64 & JVM 21+
  • Same 86-export FFI surface as Swift: keys, 14 PDAs, X25519 + PQ self-memo & AUD1RFD1 decryption, coin-selection / planMultiNoteSpendFfi, Token-2022 helpers, Mode 1 receipt, native 1-call Mode 3 ZK holdings proving & verification & 10 ix builders
  • Build Android jniLibs locally with scripts/build-mobile-sdks.sh android; no Maven artifact yet
  • Verified in CI via gradle test against spec/test-vectors.json

Same primitives in every language.

TypeScript and Rust run the full flow: keys → PDAs → ordinary-RPC CompactWalletStore sync → Mode 1/2/3 disclosure & holdings proofs → local Groth16 prover. Swift and Kotlin expose 86 zero-panic UniFFI exports including keys, PDAs, memo decryption, Mode 1 receipt verification, native 1-call Mode 3 holdings proving & verification, instruction builders, and native proving from a prepared witness; RPC sync stays in your app or embedded Rust layer.

packages/sdk · @audren-xyz/sdk@1.6.5 (zero-WASM core) + @audren-xyz/sdk/prover (BN254 Groth16 WASM)
import {
  AUDREN_DEFAULT_GATEWAY_URL,
  AudrenGatewayClient,
  CompactWalletStore,
  WSOL_MINT,
  buildAudrenPaymentUri,
  createSolanaRpcBatchFetcher,
  deriveDefiSessionKeypair,
  deriveKeysFromSeed,
  derivePoolPdaSync,
  deriveRootsPdaSync,
  deriveSubaccountKeys,
  encodePaymentId,
  exportFullViewingKey,
  exportSelectiveDisclosureProof,
  exportSubaccountFullViewingKey,
  fetchGlobalRootHistory,
  filterNotesByMint,
  parseAudrenPaymentUri,
  reconstructWitnessesForNotes,
  syncCompactStoreWithRpc,
} from '@audren-xyz/sdk';
import { AudrenWasmProver } from '@audren-xyz/sdk/prover';

// 1. Keys: reusable aud1… address, isolated sub-account, read-only viewing keys, session B_0
const seed32   = crypto.getRandomValues(new Uint8Array(32)); // load from encrypted backup in production
const rpcUrl   = 'https://your-solana-rpc.example.com';
const keys     = deriveKeysFromSeed(seed32);
const merchant = deriveSubaccountKeys(seed32, 2); // isolated #2 Merchant sub-account
const fvk      = exportFullViewingKey(keys);
const merchFvk = exportSubaccountFullViewingKey(seed32, 2); // watch-only backend (auto-decrypts payment_id)
const session  = deriveDefiSessionKeypair(seed32, 0); // public when it touches external DeFi

// 2. Private checkout invoice URI + 14 B encrypted payment_id (stored inside 106 B AEAD memo)
const invoiceUri = buildAudrenPaymentUri({
  address: merchant.address,
  paymentId: 'INV-2026-0042', // UTF-8 <= 14 B or 28-char hex
});
const parsed = parseAudrenPaymentUri(invoiceUri);
const paymentId14 = parsed.paymentIdBytes ?? encodePaymentId('INV-2026-0042'); // pass to encryptNoteMemo(..., paymentId14)

// 3. Canonical PDAs (14 audren_* seeds: PoolState + inline GlobalRootHistory + VaultGuard/PoolGuardian)
const poolPda  = derivePoolPdaSync(0).address;
const rootsPda = deriveRootsPdaSync(0).address;

// 4. Zero-indexer sync over ordinary Solana RPC (loop until !res.incomplete)
const fetchBatch = createSolanaRpcBatchFetcher(rpcUrl);
const store = new CompactWalletStore(0);
let synced = false;
for (let i = 0; i < 10_000; i++) {
  const res = await syncCompactStoreWithRpc({ store, fvk, fetchBatch });
  if (!res.incomplete) { synced = true; break; }
}
if (!synced) throw new Error('Wallet sync incomplete; do not display balance or spend');

// Match paid invoices by encrypted payment_id using your read-only Mode 2 viewing key (or merchFvk on a merchant store)
const paidNotes = store.notesByPaymentId(paymentId14, { includeSpent: true });
console.log(keys.address, merchFvk.spendPk.length, poolPda, rootsPda, session.pubkeyBase58, paidNotes.length);

// 5. Same-asset note selection + GlobalRootHistory + decoy-padded witnesses + Mode 1 receipt
const notes = filterNotesByMint(store.unspentNotes(), WSOL_MINT).slice(0, 2);
const { history, snapshot } = await fetchGlobalRootHistory({ poolId: 0, rpcUrl, requiredNotes: notes });
if (notes.length > 0) {
  const { paths, superRoot } = await reconstructWitnessesForNotes({
    fetchBatch, poolId: 0, notes, rootHistory: history, rootSnapshot: snapshot, nk: fvk.nk,
  });
  // Mode 1 receipt proves exact token + amount against SubtreePage without exposing private payment_id
  const receipt = exportSelectiveDisclosureProof(notes[0]!);
  console.log(superRoot, paths.length, receipt.leafIndex);
}

// 6. Local Groth16 prover (browser: serve wasm & 3.93 MB PK; Node: omit URLs) + optional Gateway
const prover = await AudrenWasmProver.init({
  wasmUrl: '/wasm/audren_circuits.wasm',
  pkUrl: '/wasm/audren_joinsplit.pk',
});
const gateway = new AudrenGatewayClient(AUDREN_DEFAULT_GATEWAY_URL, {
  bearerToken: undefined, // optional JWT, apiKey, or Mode 3 holdingsProof for gated operator gateways
});

Deploy your own Audren Gateway in ~45 seconds.

Gateways are optional third-party Solana fee payers implementing the open audren-gateway/v1 HTTP spec and 15-invariant Core Firewall. Deploy the standalone Mainnet Cloudflare Workers reference in one click or customize fee models, compliance hooks, and Mode 3 VIP holder gating visually.

Zero-friction Mainnet starter

One-click Cloudflare Workers deploy

audren-xyz/gateway/tree/main/cloudflare ships pre-configured for Solana Mainnet (CLUSTER=mainnet, working public Mainnet RPC, FEE_MODEL=hybrid, bounded onboarding sponsorship, all compliance hooks off). Paste a single hot fee-payer private key into RELAYER_SECRETS_JSON (Phantom Base58, solana-keygen JSON, or base64 array), fund it with ~0.05–0.25 SOL, and your Gateway is live.

Spec & 24-check verification

Verify any Gateway implementation

Run the open-source 24-check conformance CLI against your Cloudflare Worker or any custom Rust, Go, Node.js, or Bun implementation of audren-gateway/v1.

npx --yes @audren-xyz/gateway-conformance \
  --url https://your-gateway.workers.dev \
  --cluster mainnet
Examples and escrow DeFi CPI

Runnable examples across all four languages

audren-xyz/examples mirrors the core Audren flows (keys, sub-accounts, encrypted 14 B payment memos & merchant invoicing (merchant-invoicing), pseudonymous DeFi Sessions (B₀, B₁…), local WASM/native Groth16 proving, Mode 1/2/3 disclosure & live ZK single and portfolio holdings proofs (holdings-proof, institutional-audit), and ExecViaEscrow instruction building) across Rust, TypeScript, Swift, and Kotlin, with full ordinary-RPC CompactWalletStore sync and Mainnet/Devnet submission examples in Rust and TypeScript.

  • ExecViaEscrow (Tag 6) supports any compatible PDA-signing Native SOL, SPL, or Token-2022 Solana program CPI (including lossless partial-fill AUD1RFD1 refunds via EXEC_FLAG_REFUND_LEFTOVER, zero-output actions via EXEC_FLAG_ZERO_OUTPUT, direct native SOL legs via EXEC_FLAG_NATIVE_SOL_IN / EXEC_EXT_FLAG_NATIVE_SOL_OUT, separate TransferHook accounts via EXEC_EXT_FLAG_SEPARATE_HOOK_ACCOUNTS, and input/output gateway fees via EXEC_FLAG_FEE_ON_OUTPUT) with strict pre/post escrow integrity checks.
  • Self-paying Transact (Tag 5) supports atomic WITHDRAW_FLAG_UNWRAP_WSOL to fund 0-SOL wallets or session keypairs (plus up to 4 parallel 2 → 1 merges per Solana Transaction v1 via direct Transaction v1 self-pay or on Gateways with FVK, free, or offchain batch-private support), paired with unified zero-dust Deposit(DEPOSIT_FLAG_NATIVE_SOL | DEPOSIT_FLAG_FEE_FROM_AMOUNT) sweeps.
  • All four example suites import the official SDKs directly with zero duplicated cryptography.
Checklist

Read before integrating

Audren verifies proofs under the Hermez Perpetual Powers of Tau (54 contributions plus a beacon) plus a BGM17 Phase-2 ceremony that so far has only Audren’s two contributions (ceremony/transcript.json), and remains pre-audit with mutable upgrade authority pending independent security review.

  • Persist CompactWalletStore locally (IndexedDB / mobile disk) with an optional birthday slot so recovery skips pages closed before the wallet existed.
  • Back up the encrypted 32-byte master seed (PBKDF2-SHA256 600k + AES-256-GCM); lost spend keys cannot be recovered by any operator, and portable backups preserve access across future Solana PQ wallet migrations.
  • Use v1.6.0 post-quantum symmetric self-memos (encryptSelfNoteMemo / prepareDynamicSelfNoteMemo) for all self-owned deposits, change, swap outputs, and refunds, keep default strict nk-keyed HRW decoys enabled, and wire VaultGuard / PoolGuardian / TripSoundnessCanary handling per docs/CRYPTOGRAPHIC_RESPONSE.md.
  • Surface clear UX notices that deposits, withdrawals, DeFi CPI legs, and session wallet positions remain public on Solana.
  • Fetch GlobalRootHistory via fetchGlobalRootHistory({ poolId: 0, rpcUrl, requiredNotes: notes }) (finalized-first with confirmed fallback for instant spendability upon confirmation, target ~150ms under Alpenglow; or call selectRootSnapshotForNotes on decoded history), and prepend buildAutoOpenPageInstructions on direct transactions with calibrated tight CU limits.
  • Gateways (audren-gateway/v1) are strictly optional: submit via Direct Self-Pay, fund a one-time burner wallet (from an external SOL source or a one-time WITHDRAW_FLAG_UNWRAP_WSOL withdrawal paid by an already-funded wallet or Gateway) for subsequent zero-gateway spends, or deploy your own Gateway with custom monetization and compliance hooks.

Inspect the on-chain specification.

Exact fixed ≤10 KiB account layouts, 17,861-R1CS BN254 Groth16 constraints, and measured sBPFv3 Compute Units.