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.
- November 19, 2026: 6 of 6 blocked. One check was missing: nothing had an expiry or a list of allowed payees, so a small permission file was added.
- November 20, 2026: 13 of 13 blocked, with seven attacks on x402 payments added. Then 23 of 23, with ten attacks on the signed mandate.
- November 23, 2026: 24 of 24 blocked, with payouts split across fresh addresses added. No check was missing: the totals never looked at the address.
- Considered, not built: a first payout to an address the ledger has never paid would wait until a person approves it, instead of being refused or only flagged. Suggested by Ben Puddle.
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:
- That a person signed. The user's key is a file on the same machine, under the same login as the agent. The payment code never loads it, and a test checks that, but anything running as that user can read it. A real version keeps that key on another device or in a hardware key.
- Who the user is. There is no issuer (Verifiable Intent's L1), so nothing ties the user's key to a person beyond its place in the code.
- That anyone else checks the mandate. In AP2 the other side verifies the mandate and returns a signed Mandate Receipt. Here the payer checks its own mandate. The facilitator that settles x402 payments and the USDC contract know nothing about mandates, and on chain a payment without a mandate looks the same as one with.
- That the ledger is complete. It is a local file with no signatures between its lines. Deleting a line (a revocation, a refusal, a whole payment) changes the report's answer without a trace. Only the signed lines resist an edit.
- That a model resists prompt injection. In the live run the model ignored the injected text. That the checks stop a model that agrees to pay is shown only by a scripted test, which is a statement about the code, not about the model.
- That "yes" was typed. Payouts recorded before step 6 can't be told apart from ones approved with the
--yesoption, and the report says so. From step 6 on, the ledger records what the prompt got (a typed "yes", a typed total for a batch, or--yes), not who typed it. - Conformance with the standards. The mandates are plain signed JWTs with AP2's and Verifiable Intent's field names, not SD-JWT, with no key-binding JWT and no checkout mandate. A mapping document in the project lists what matches and what is only imitated.
- Anything about real money. Test network, test keys and test USDC only.
Code
The code is being prepared for release.