Letting an agent collect its own money: from zero to first stranger in 72 hours
One server, seven cents, three days — building a service that strangers' agents discover, pay, and independently verify. Architecture, timeline, eight real pitfalls, and the discipline that matters more than the code.
Three days. One server. Under a dollar in cash spent. What came out the other end: an autonomous data service that strangers’ agents can discover, pay, and have independently verified. This is the technical retrospective — architecture, route, pitfalls — all first-hand, nothing polished after the fact.
1. Goals and constraints
One goal: validate the minimal loop of an autonomous economy — an agent discovered, paid, and served by another agent it has never met, with no human anywhere in the chain.
The constraints I gave myself: a $2 budget, a single server (shared with other projects), no funding, no team — plus one engineering iron rule: any claim of “done” must ship with machine-checkable evidence. That rule saved the project more than once (section 5).
2. Architecture: three layers
Figure 1 · Three layers — storefront, discovery, payment engine — and how the outside world reaches them.
Layer 1 — the payment engine. x402 puts a checkout counter on plain HTTP: an unpaid call gets 402 plus a bill (price, network, receiving address); a paid call gets 200 plus data. Settlement runs on Base mainnet in USDC. The key insight: the bill itself is a machine-readable price tag — no “contact us for pricing”.
Figure 2 · The lifecycle of one payment: request → bill → payment → delivery → reconciliation.
Layer 2 — discovery: five streets, all paved. A great service nobody can find is worth zero. Five places matter: CDP Bazaar (Coinbase’s public directory), MCP Registry, ERC-8004 (on-chain agent identity), A2A agent-cards, and marketplaces like Virtuals ACP. One mechanism worth knowing: listing is triggered by settlement — every completed payment makes the directory crawlers re-visit and refresh your entry within seconds. Self-test purchases aren’t just testing; they’re feeding the directories.
Layer 3 — the storefront. A dual-entry website: pages for humans, interfaces for machines — with every displayed number linked back to its on-chain evidence. The storefront is fully isolated from the payment engine: if the shopfront falls over, the business keeps running.
One more thing people forget: wallet hygiene. The receiving wallet is a hot wallet holding working funds only; the key lives in a restricted directory on the server, never in the codebase, never on a web page. That matters more than any firewall — don’t keep money worth attacking on the machine.
3. The route: 72 hours
Figure 3 · The 72-hour timeline: launch → listings and first external income → first stranger and independent verification.
- Day 1: wallet + service skeleton + first mainnet self-purchase — the full loop proven the same day (self-testing means buying your own service with a separate buyer wallet, exercising payment, delivery and reconciliation for real);
- Day 2: all five channels listed; rich metadata written into the protocol layer; an external monitoring service paid for a call — first external income;
- Day 3: a CDN in front (US latency 452ms → 57ms); at 1 AM, the first stranger — an endpoint-audit directory paid $0.005 unattended; the same day, an independent verification service bought our data, verified delivery, and published a “safe to buy” rating;
- Wrap-up: the dual-entry website went live — the site you’re reading this on.
4. Eight pitfalls (real ones, ranked by pain)
① Rich metadata blew up the bill. After a metadata upgrade, one service was “unbuyable from the public internet” for nearly two hours — while direct-to-origin tests passed fine. Root cause: the enriched 402 bill exceeded 4KB, and the reverse proxy’s default buffer is 4KB — the bill was silently truncated. Lesson: metadata is not a comment; it is part of the payment surface. Change it, regression-test the whole proxy chain.
② Twenty-eight characters broke checkout. A description grew from 476 to 504 characters — and payment validation started rejecting it, while the same client happily bought from other services. Ten minutes of A/B testing located it: there is a length cap on fields that travel through payment validation (observed boundary between 476 and 504). Lesson: run a length gate on payment-carried metadata before every release.
③ A “look but don’t buy” request bypassed the counter. HEAD requests (asking “does it exist?” without fetching) weren’t caught by the paywall — they returned 200, complete with the response size and a content fingerprint. “No body = no leak” is an illusion: the leak surface is in the headers. Fix: paid endpoints answer HEAD with the same “pay first” wall.
④ A credential landed in plaintext in the session logs. During a key-backup handoff, the passphrase was pasted into a terminal session — and the delivery channel itself gets written to disk by tooling. Lesson: before handing over any secret, trace where it will land; if it can be generated on the receiver’s side, never generate-and-send.
⑤ Concluding “not listed” too early. Indexing is asynchronous (about two hours in practice). “I checked once and didn’t see it” is not “it’s not listed”. Fix: a full re-scan script, no early stop — which later became a permanent check.
⑥ Debug payment failures with a control purchase. When our own purchase failed, we immediately bought from a competitor with the same client. Their purchase succeeded → rule out client and network, lock the search onto our own service. A control experiment beats log-staring by an order of magnitude.
⑦ Restart survivability. The reverse proxy was a hand-started orphan process — one reboot would take the whole site down. Moving it under a supervisor (plus automated certificate renewal) turned availability from luck into self-healing.
⑧ The four-minute CDN scare. After switching to the CDN, certificates had a ~4-minute issuance window and browsers threw warnings — expected behavior, not a failure. I resisted the urge to roll back. Lesson: before any migration-type change, write down which symptoms are expected — otherwise you’ll fight normal behavior.
These eight share one property: none of them shouts. All silent. Which is why the next section matters more than any fix.
5. Engineering discipline: what mattered more than code
Give every pitfall a gate. Each lesson produced not just a fix but an automated check that makes the pitfall class impossible to silently repeat: bill-integrity checks, description length caps, HEAD interception tests, secret-residue scans. The list of mechanisms is the list of accidents.
Evidence discipline. “I verified it” doesn’t count — verification must leave a machine-readable trace (exit codes, file fingerprints, on-chain transaction IDs). When people are required to leave evidence, fabrication gets expensive.
Two ledgers. Self-test purchases and real external revenue are recorded separately, and only the verifiable book is ever shown externally. Books that lie to yourself do not survive third-party inspection.
Honest data is an asset — not a virtue. Every number an agent-facing service displays may be independently checked. We only show what can be verified on-chain; untrackable metrics (like a made-up “99.4% uptime”) are simply omitted. Being verified is the credential.
6. The bill (all real)
- Time: 3 days
- Cash spent: ~$0.07 (experiment purchases + on-chain fees)
- Revenue: $0.025 (3 independent payers, 4 settled payments)
- Every incoming payment reconciled against the ledger to the cent, zero drift
This is options logic: buy process-evidence at a tiny cost, let revenue follow exposure and listings.
7. For fellow builders
The minimal route, if you want to do this: build one real small service → put an x402 counter on it → pave the five discovery streets → build trust with self-tests and external verification → wait for the strangers. Starting beats perfect — but every step should leave evidence.
The full numbers live on the /agent/ page — every digit is verifiable on-chain.
Postscript: every pitfall in this report later became an automated check — the whole toolkit is open source: x402-seller-starter (preflight script / proxy-buffer example / discovery checklist, MIT). Skip the rediscovery; start from there.