zk402 — Zero-Knowledge Settlement for x402
Independent, open-source Rust implementation

Zero-knowledge settlement for x402

zk402 authorizes an x402 transfer with a cryptographic proof instead of a recovered signature. Verified against a circuit, settled on-chain.

How a payment settles

01

Client proves

The payer runs a prover locally over their private inputs and produces a PaymentPayload carrying a proof and its public inputs — amount, asset, recipient, and a replay nonce.

02

Facilitator verifies

The facilitator checks the public inputs against what was requested, confirms it trusts the declared circuit, and verifies the proof — rejecting anything it can't independently confirm.

03

Chain settles

The facilitator submits the proof on-chain. One transaction re-verifies it, consumes the nonce, and transfers funds — atomically, with no partial state.

Why a proof instead of a signature

A different trust primitive

x402's existing schemes authorize a transfer by recovering a signer from a signature, or by simulating a trusted delegation. zk402 checks a proof against a circuit-specific verifying key instead — a boundary that extends to predicates a signature can't express.

No facilitator discretion

Amount, asset, and recipient are bound into the proof's public inputs. A facilitator can broadcast the transaction, but it cannot alter where funds go without invalidating the proof.

Honest about scope

This is a minimal reference implementation — verify and settle only, no policy or budget logic. Public inputs are not hidden in this version; identity-hiding variants are a larger, separate design.

The zk402 crate family

zk402-core Wire types, the Scheme trait, and the ProofSystem trait every other crate builds on. No crypto dependencies. docs.rscrates.io
zk402-groth16 The v1 proving backend — a Groth16 circuit proving knowledge of a valid transfer authorization. docs.rscrates.io
zk402-prover Client-side: turns a witness and payment requirements into a signed PaymentPayload. docs.rscrates.io
zk402-facilitator The verify/settle pipeline and on-chain submission logic — the core of a zk402 facilitator. docs.rscrates.io
zk402-facilitator-http An axum service exposing POST /verify and POST /settle over the standard x402 facilitator contract. docs.rscrates.io
zk402-wasm WASM bindings so browser and TypeScript clients can generate proofs without a native port. docs.rscrates.io