x402 and PQ-402
PQ-402 is x402 made post-quantum. It keeps the x402 flow and its v2 wire format, and replaces the two parts a quantum computer breaks.
What x402 is
Section titled “What x402 is”x402 describes itself as “an open payment standard” that lets clients pay
for resources. Over HTTP the flow is three steps: the server answers 402 Payment Required with a price, the client
retries with a signed payment, and the server answers and settles. There is no account to create and no API key to
hand out: the payment itself is the credential. The specification is
x402-specification-v2.md, with the
HTTP transport in transports-v2/http.md.
Its two weak points
Section titled “Its two weak points”- The payment is authorised with a classical signature. On EVM chains, x402’s
exactscheme by default authorises the transfer with an EIP-3009transferWithAuthorization, an EIP-712 signature by the payer’s EVM account (scheme_exact_evm.md). An EVM account signs with ECDSA over secp256k1, which a large enough quantum computer could forge. - The answer is not encrypted by the protocol. The specification leaves response bodies to the server and defines no encryption: request and answer are only as private as the TLS connection that carries them. Anything recorded past TLS, at a proxy or a load balancer, can be read, and a recording can be kept and read later.
What PQ-402 replaces
Section titled “What PQ-402 replaces”- Payment signatures are ML-DSA-87 (FIPS 204), verified on chain by the contract that moves the money, against the key the payer registered with proof of possession.
- Request and answer are sealed with ML-KEM-1024 (FIPS 203) to keys read from the chain’s KEM key registry, never from the other side’s messages.
- Every answer carries a receipt signed with the server’s ML-DSA-87 key, bound to the exact bytes of the answer.
- Each payment is bound to one request: it signs a hash of the method, the path and the body as sent, so it cannot pay for a different request.
Everything else stays x402 v2: the same 402, the same PAYMENT-REQUIRED, PAYMENT-SIGNATURE and PAYMENT-RESPONSE
headers, the same PaymentRequirements and PaymentPayload shapes, and the @x402/core plugin interfaces, used
unchanged. The new parts are two schemes (pq-erc20, pq-perennial) and one extension (pq402-sealing), the
extension points x402 already has.
Side by side
Section titled “Side by side”x402 (exact scheme on EVM, default) |
PQ-402 | |
|---|---|---|
| Payment signature | EIP-3009 authorisation: EIP-712, ECDSA secp256k1 | ML-DSA-87 (FIPS 204) |
| Verification | facilitator recovers the signer; the token contract checks it at settlement | facilitator checks against pqcKeyStatus; the escrow or vault checks it again on chain with pqcVerify |
| Answer confidentiality | not specified; TLS only | sealed with ML-KEM-1024 to the payer’s registered key, with a signed receipt |
| Replay | random 32-byte nonce, spent by the token contract; validity window | nonce spent by the escrow or the vault; validity window; bound to one request’s method, path and body |
| Wire format | x402 v2 headers | the same x402 v2 headers; payment header about 9.4 KB |
The left column was checked against the x402 specification on 29 November 2026. The right column is the PQ-402 specification; see how it works and the wire format.