Pay 0.01 mUSDC, unlock the endpoint.
A Midnight facilitator ports the x402 v2 spec off Base and onto a Compact-witness signing scheme. Settlement uses MidnightUSDC, a mimic token with no peg. Read the disclaimer before extending.
- Step 1 · Challenge
GET /api/public/x402-challenge → 402 { x402Version:2, accepts:[{ scheme:'midnight-mUSDC', network:'midnight:preprod', asset:'0x…MidnightUSDC', amount:'10000' }] }
- Step 2 · Sign
Local circuit produces witness proof over (from, to, amount, nonce, expiry). Wrap in v2 envelope under `accepted`.
- Step 3 · Retry
GET /api/public/x402-proxy with base64 PAYMENT-SIGNATURE header.
- Step 4 · Settle
Facilitator submits MidnightUSDC.transfer(...). Returns PAYMENT-RESPONSE: { midnightTxHash, network, payer }.
Contract source: contracts/MidnightUSDC.compact. Faucet caps every mint at 10 mUSDC — deploy your own if you need more headroom.
The full protocol block for x402 is embedded in every prompt tagged with agentic · x402.
m402 (Hack Buenos Aires open-track winner) runs the same 402-and-retry flow on Midnight with no payer in the payment: a vault pools NIGHT and mints a shielded credit 1:1, and its pay circuit takes no payer argument and reads no caller identity. The gateway only reads the chain — the agent submits its own transaction.
Quote the cost honestly. Measured on Preview, a pay is 23–25 s end to end: proof 1.4 s, submit 22.5 s, chain 1.5 s, and verifying a proof takes ~3.4 ms. Submission dominates; calling the whole 25 s "generating a zero-knowledge proof" is wrong by an order of magnitude. The bigger cost is wallet sync — 687 s cold from seed vs 54 s with the sub-wallet states cached.
Its docs/constraints.md is required reading before you design a payment circuit; the failure modes are on our Known issues page.