Project ยท Apache-2.0

Stablecoin payout prototype

A personal, non-commercial prototype on a test network. No real money.

The prototype sends USDC payouts on Base Sepolia, Base's test network, with test keys and test money only. Its checks run before anything is signed, and it is growing toward the controls AI agents need before they can pay. I'm building it with Claude Code. It is licensed under Apache-2.0.

Why

Moving a stablecoin is the easy part. The harder part is knowing a payout is safe to send: which network you're on, whether the token really is the issuer's, how much may leave, and when the money actually landed. A person can check those things by eye in a wallet. Software and AI agents that pay on someone's behalf need them as explicit checks. The prototype turns each one into a check that runs before anything is signed.

The six steps

1. One payout from a script, with checks before signing

Done. On November 7, 2026, one test USDC was confirmed on the test network for a fee of about 0.00000037 test ETH. What broke was getting test money: Coinbase's faucet needs a developer sign-in, and Circle's starts on Arc Testnet, not Base Sepolia.

2. A payout from a request, tracked from requested to confirmed or failed

Done. On November 7, 2026, a request was paid and confirmed, running it again stopped with "already paid", and a request for 25 USDC failed the cap check before any network call. The lesson: a refusal counts as a failed payout, so the payout success rate read 1 of 2 (50%) even though the checks did their job.

3. Batch payouts from a CSV file, in one ledger matched to the chain

Each row has an idempotency key, which stops the same payout from being paid twice, and every payout goes into one ledger, whatever the payment protocol. Done. On November 20, 2026, all 3 rows (3.5 test USDC) were confirmed, a rerun paid nothing, a reused key was refused, and reconciliation matched every payout and accounted for all 5 transactions the paying wallet had sent. What broke was the optional scan of past blocks: Base's public endpoint refuses log searches over more than 200 blocks, not the 2,000 its docs suggest, so the scan now goes 200 blocks at a time.

4. An agent paying for an API over x402, under the same checks and in the same ledger

Done. On November 20, 2026, the agent paid a local test API 1 cent of test USDC over x402. The payment was confirmed about a second after signing, with no ETH and no prompt. A rerun paid nothing, an edited copy of the permission was refused, and reconciliation matched the payment, its authorization and the agent's balance. Nothing broke live. The lesson: an x402 payer sends no transaction of its own, so step 3's check of the wallet's transactions can't see these payments. Reconciliation instead asks the token contract whether each authorization was used, and checks the agent's balance against the ledger.

This step follows the human-not-present x402 flow of AP2 v0.2 (Google's Agent Payments Protocol), with a record shaped like a closed mandate for each payment.

5. Agent payouts only inside a signed mandate

The mandate sets a cap, a list of allowed payees and an expiry. Anything above the cap needs a person's approval, and the checks must block a prompt-injection test.

Done. On November 28, 2026, under a signed 24-hour mandate (1 cent per payment, 50 cents in total), the agent, a model with one tool, paid the local test API 1 cent with no prompt. A 5-cent call was not paid and waited for approval. A typed "yes" signed that one payment, and it was paid. A second one was refused, and the refusal is in the ledger. After the mandate was revoked, the next call was refused. Reconciliation matched every payment and its authorization, and both signatures on each payment, and the approval's, can be verified from the ledger alone.

Prompt injection, live: in two runs, the test API's reply carried injected text telling the agent to pay 9 USDC to another address. The model ignored it. So the live runs show only that nothing was paid because of it: the only payments were the 1-cent quotes the tasks asked for. That the checks stop a model that does agree to pay is shown by a scripted test, not live.

What broke: the agent can't finish an approved payment. Each agent run makes a new request ID, and an approval belongs to one request ID, so the approved payment was paid with a separate command. The six agent runs cost $0.0014 in model fees in total.

The mandate is an AP2 v0.2 open payment mandate that maps onto Verifiable Intent L2 (Autonomous).

6. An evidence report for any payment

Not done yet. For any payment, a report that answers "did the human approve this?", plus a demo and a write-up. The report's sections use AP2 and Verifiable Intent terms (open and closed payment mandates, L2 and L3a).

Checks under attack

Alongside the steps runs a growing set of attacks the payout checks must block, reported as a pass or fail table: an instruction injected into a request, a swapped payee, an amount over the cap, a repeated request, an expired permission, and payouts split to stay under the cap. It grows with steps 4 and 5.

What this doesn't prove

The checks and the evidence report are code on one machine, run against a test network. They don't show:

Code

The code is being prepared for release.