Skip to main content

x402-coffer Architecture 🟑 Beta

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
/verify ─────▢│ Verification Pipeline β”‚
β”‚ 1. decode payment payload β”‚
β”‚ 2. schema + expiry check β”‚
β”‚ 3. signature recovery β”‚
β”‚ 4. nonce/replay cache β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
/settle ─────▢│ Settlement Engine β”‚
β”‚ chain adapter (base, solana)β”‚
β”‚ broadcast + confirm + receiptβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–Ό
Postgres (payment ledger)

Design rules​

  1. Verification is pure β€” no side effects, safe to call speculatively.
  2. Settlement is idempotent β€” same payload twice = same receipt, one transfer.
  3. Replay protection before signature math β€” cheap rejects first.
  4. Ledger is append-only β€” disputes resolve from the ledger, not logs.

Failure handling​

RPC failure during settle β‡’ coffer returns a retryable error; the payment payload remains valid until its expiry, and idempotency guarantees no double-charge on retry.