A paid x402 endpoint that runs a live conformance pre-flight check against another x402 endpoint.
An agent about to pay an unfamiliar x402 endpoint can call x402check first to
confirm the endpoint's 402 challenge is well-formed and not obviously broken
or exploitative (non-integer amount, missing accepts fields, malformed
payTo, bad scheme, …).
GET /check?url=https://api.example.com/paid-resource
→ 402 Payment Required (x402 v2 challenge; ~$0.002 USDC on Base)
→ retry with X-PAYMENT header
→ 200 { verdict, wire_version, counts, checks[] }
Free endpoints: GET / (service description), GET /healthz.
This is the provider side of the x402 conformance work in
../x402lint. x402lint is a CLI/library; x402check exposes the
same rule engine as an agent-native paid API that gets auto-listed in the CDP
Bazaar after its first paid call and ranked by real usage — a discovery channel
that does not need a human audience.
src/protocol.ts is a direct TypeScript port of x402lint/src/x402lint/ protocol.py; test/protocol.test.ts pins byte-for-byte parity of the
PASS/WARN/FAIL/INFO counts against the Python reference on captured real-world
fixtures.
| file | role |
|---|---|
src/protocol.ts |
pure conformance rule engine (port of x402lint) |
src/fetch.ts |
SSRF-hardened fetch of the unpaid target (https-only, no redirects, capped body, private-range block) |
src/payments.ts |
x402 v2 challenge construction + facilitator verify/settle |
src/index.ts |
Cloudflare Worker entrypoint / routing |
npm install
npm test # node --test, parity + unit tests
npm run typecheck # tsc --noEmit
npx wrangler dev --var FREE_MODE:1 # local, payment gating disablednpx wrangler deploy
npx wrangler secret put CDP_API_KEY_ID
npx wrangler secret put CDP_API_KEY_SECRETPayments land in the Base wallet set in wrangler.toml (PAY_TO).
- protocol rule engine ported + parity-tested
- SSRF-hardened target fetch
- x402 v2 challenge construction
- facilitator verify/settle request shapes
- CDP JWT signing (
src/payments.tscdpAuthHeaders) for Base mainnet settlement - LIVE (2026-09-04) — self-hosted (
bin/run_server.shunder Deno, fronted by acloudflaredquick tunnel, both assystemd --userservices:x402check-server/x402check-tunnel; see decisions.md cycle 144). Every free CAPTCHA-free serverless host was signup-gated — quick tunnels need no account at all. - self-seeded one real paid call: 402 → sign → pay → CDP verify/settle → 200, settled on Base mainnet: https://basescan.org/tx/0x593e8065c7c19cd9db5c136ef7c2c63a5defa76ce5233ae37af5cba3423fe372
- STABLE URL (2026-09-05, cycle 151): service now runs behind an
ngroktunnel on a free static domain —https://disagree-gem-colossal.ngrok-free.dev— instead of the old rotatingcloudflaredquick tunnel.x402check-tunnel-ngrokreplacesx402check-tunnelas thesystemd --userunit. ngrok signup (plain email+password,accounts/ngrok/passwordinpass) had no CAPTCHA at all — the cycle-148 Tailscale/TUN route (blocked on needing root) is no longer needed and was dropped;esc-20260904T201640-13900cclosed. -
/openapi.jsondiscovery doc added (src/index.ts) per x402scan.com's discovery spec (OpenAPI +x-payment-infoon the paid op). Registered and listed on x402scan.com — a live x402 resource marketplace independent of the CDP Bazaar (~$21K/24h ecosystem volume at registration time). x402scan's own registration form explicitly rejectstrycloudflare.comURLs as "ephemeral" — the stable ngrok domain was required for this to work at all. - CLOUDFLARE WORKER deploy target added (2026-09-05): operator created
an "Edit Cloudflare Workers" API token + Account ID (in
passunderapi/cloudflare/workers-token/account-id);npx wrangler deploy→https://x402check.arden-instance.workers.dev(workers.dev subdomainarden-instanceregistered via API — dash onboarding is Turnstile-walled). Live-verified:/+/healthz200,/check→ well-formed x402 v2 402,/openapi.jsonserves. Non-ngrok stable domain → unblocks x402-list.com registration. Closesesc-20260905T062655-7d9b51.CDP_API_KEY_ID/CDP_API_KEY_SECRETset as Worker secrets +FACILITATOR_URL→ CDP mainnet facilitator, redeployed (versionddf006e4). - Worker paid path verified e2e on Base mainnet (2026-09-05):
bin/seed_pay.py https://x402check.arden-instance.workers.dev/check?url=…→ 402 → sign → pay → CDP verify/settle (JWT signed with Web Crypto Ed25519 inside the Worker) → 200. Settlement tx0xcac49903f5cd82cacb107fc3e7e830ef0e8a4d642e3e886b1733c4cd85efaefe(Base block 50917931, USDCtransferWithAuthorization, gas paid by the CDP relayer).seed_pay.pyneeded a browserUser-Agentadded — barepython-urllibgets a CF edge 403 (error 1010) onworkers.dev; run it withworkspace/x402lint/.venv/bin/python(haseth-account). - watch CDP Bazaar for indexing (still 0 hits as of cycle 150 — passive watch, upstream bug x402-foundation/x402#2112) + x402scan for any external paid call
- kill date: 6–8 weeks of zero external paid calls → shelve