Nick Stavros

I'm going to show you the actual plumbing of a live x402 service — including the two bugs that only showed up with real payments, and the pricing mistake we fixed on day one.

Quick disclosure: this service was designed, coded, and deployed by Conway, an autonomous Claude-based agent I supervise. I'm a non-developer; the agent wrote every line, and I approve anything irreversible. That's part of the experiment.

The problem

Every transaction starts with a question nobody budgets for: who am I paying? Sending to a Base address usually means pasting hex and hoping. The chain knows whether that address is a contract or a wallet, whether it's ever been used, what it holds — but packaging that answer per-request, payable by a machine without an API-key signup, wasn't a thing until x402.

So: Conway Address IntelGET /report/{address} returns a structured due-diligence report for $0.02 USDC, paid inline via HTTP 402. A free /overview/{address} returns the preview (contract vs wallet, holds-funds, activity bucket) with no wallet needed at all.

The whole payment layer is ~10 lines

With x402-express, the middleware answers 402 with signed terms, verifies the buyer's USDC authorization through a facilitator, and settles after your handler responds:

import { paymentMiddleware } from "x402-express";
import { facilitator } from "@coinbase/x402"; // mainnet, auth via CDP keys

app.use(paymentMiddleware(
  PAY_TO_WALLET,
  { "GET /report/*": { price: "$0.02", network: "base" } },
  facilitator,
));

Enter fullscreen mode Exit fullscreen mode

The buyer side is just as short with x402-fetch:

import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";

const payFetch = wrapFetchWithPayment(fetch, privateKeyToAccount(KEY));
const res = await payFetch("https://.../report/0x4200...0006");
// 402 → sign EIP-3009 USDC auth → retry → 200. Buyer needs zero ETH; facilitator pays gas.

Enter fullscreen mode Exit fullscreen mode

Three things that only showed up with real payments

1. Settlement happens after your handler responds. We logged receipts inside the handler and every real payment got recorded as "SIMULATED" — the settlement header didn't exist yet. Fix: read X-PAYMENT-RESPONSE in res.on("finish"). Our first real testnet settlement is forever mislabeled in the ledger, with an append-only correction entry after it. Ledgers don't get edited.

2. Validate before the payment layer, or buyers can pay for garbage. Middleware order matters: our address validation runs before paymentMiddleware, so GET /report/0xNOTANADDRESS gets a 400 that says "you have not been charged" — and that's structurally true, terms are never even offered.

3. Test the failure path with real money. We pointed the service at a dead RPC and made a real (testnet) payment attempt: handler 503'd, and the middleware — which only settles 2xx responses — never charged the buyer. "Failed requests are never charged" is now a claim we've watched happen, not a hope.

The pricing lesson

We launched at $0.50/report. Then we read the room: x402 services cluster around $0.02–0.03/call. At 20× the median, nobody impulse-tests you — and impulse tests are the entire top of funnel when your buyers are other people's agents. We repriced to $0.02 and made the preview free. Marginal cost is ~zero (pure RPC reads), so every call at any price is margin; the bet is volume and integration, not markup.

The discovery chicken-and-egg

Here's the funny part: the main x402 discovery index (the Bazaar) lists you automatically on your first settlement — there's no submission form. So a brand-new service needs its first paying customer to become findable by paying customers. Our solution: a free endpoint anyone can integrate without funds, a machine-readable manifest at /.well-known/x402, an honest /status page (counters reset each deploy — it says so), and showing up in the places x402 builders actually talk.

Try it (free, right now)

curl https://conway-address-intel-production.up.railway.app/overview/0x4200000000000000000000000000000000000006

Enter fullscreen mode Exit fullscreen mode

Full report is 2¢ via any x402 client. Manifest: /.well-known/x402 · Status: /status · FAQ: /faq

Honest scope, stated plainly: live public onchain data only. Not a security audit, not scam detection, not financial advice. If your x402 client chokes on our 402 flow, tell me — the agent fixes fast.

As of publishing, this service has settled exactly zero mainnet dollars — our first buyer's 2¢ literally puts us on the map (the Bazaar indexes on first settlement). Want the permanent line in an AI agent's append-only ledger? It's available.

web3 #base #x402 #agents