AI agents can now pay for APIs on their own with x402: the server answers "402 Payment Required", the agent signs, and the data comes back. There's no checkout and no human. That also means an agent can pay a fake shop that copies a real one's name, or pay for an empty response. Every agent learns this alone, after it has already paid.
Leash is a payment guard and a shared merchant registry for these agents. Before an agent signs any x402 payment, Leash gives one of three verdicts: ALLOW (pay now), ESCALATE (ask the owner) or DENY (never pay).
It checks three things:
- Who the merchant claims to be. Each merchant declares its payment policy in its own ENSv2 name: the account to pay, max price, domains and the fields every response must carry. A 402 that asks for a different account, or a higher price, is denied.
- What other agents have proven about this merchant. After each payment, the guard checks the response against the merchant's declared fields and files a signed good or bad report to Arkiv. Every report is re-checked against its real payment on Hedera before it counts. When agents with different funding sources each prove a merchant bad, it is blocked for everyone. One agent's bad experience protects every other agent.
- The owner's limits: budgets, per-merchant caps, a smaller budget for new merchants, and owner approval above a set amount.
No verdict is permanent. Blocks and evidence expire, and a merchant can file a rebuttal, pass a paid retest and earn trust back through probation. Every decision, report and approval is logged to a Hedera Consensus Service topic, as a tamper-evident audit trail.
What you can try today:
- A live demo with real agents and real merchants
- An owner console for approvals
- A public explorer showing each merchant's health from verified evidence
- A Partner tracks page showing every on-chain write and query live
- A "Create merchant" flow where any merchant with an ENSv2 name proves control of it, publishes its policy and lists itself
Developers can add Leash with one SDK call, or through an MCP server so an LLM agent like Claude pays through Leash. Everything runs on public testnets: Hedera testnet USDC, Arkiv's Rabdi testnet and ENSv2 on Sepolia. Nothing is mocked.
Leash is a TypeScript monorepo (pnpm workspaces) with five parts:
- packages/core: a pure policy engine. It rebuilds each merchant's standing from evidence: new, established, blocked or probation. It then computes a five-factor risk score and returns the verdict.
- packages/guard: hooks into the x402 client's onBeforePaymentCreation and onAfterPaymentCreation. It decides before the agent signs, then checks delivery and files reports after.
- packages/mcp: an MCP server with 7 tools.
- apps/merchant: five real x402 merchants built on Hono, @x402/hono and @x402/hedera, each deployed on Vercel. Two are honest, one delivers junk, one impersonates another, and one has no identity.
- apps/dashboard: a Next.js 16 site with the live demo, owner console, explorer, Partner tracks, docs and the Create merchant flow.
Hedera:
- Payments use the x402 exact scheme on Hedera testnet, settling in USDC (HTS token 0.0.429274) through the Blocky402 facilitator. The facilitator pays the fees, so $0.005 payments are practical.
- Mirror Node makes reports trustworthy. The guard re-checks every report's transaction there: payer, payee, amount and consensus time. It verifies the agent's signature against the account's key, and groups wallets by who funded them, so one owner's many wallets count as one voice.
- The Hiero SDK writes every decision to an HCS topic, which holds over 700 messages.
Arkiv:
- It holds the shared registry as four entity types: reports, probes, rebuttals and merchant listings. All are written with @arkiv-network/sdk and owned by the wallet that wrote them.
- Expiry is our forgiveness model: evidence lives 60 days in production.
- Indexed attributes let the guard query a merchant's reports newest-first before every payment, and never fetch future-dated rows.
- Probes and listings are trusted only when the expected wallet created them, so a flood of fake rows can't bury real ones.
- Reads need no key, so the public explorer works for anyone.
ENSv2 on Sepolia:
- Each merchant's name is registered through ENS's ETHRegistrar, with its own Permissioned Resolver deployed through VerifiableFactory.
- The payment policy lives in leash.* text records, read through the Universal Resolver.
- Enhanced Access Control grants a wallet the right to edit only the leash.rebuttal record. Self-listing requires proving the text role on your own resolver.
- Each merchant's 402 names its ENS name in the x402 extra field, so the agent can find the policy.
Notable hacks:
- A disclosed "live policy profile" where 1 policy day equals 18 real seconds, so blocks, probation and expiry play out inside a short live demo, on real testnets.
- We checked ENSv2 function selectors against live bytecode, because the contracts on GitHub main differ from the ones deployed on Sepolia.
- 65-byte EVM signatures don't fit Arkiv's 128-byte string limit, so they go in a bytes field.
- A SQLite outbox keeps Arkiv and HCS writes safe through outages, and the guard escalates rather than guesses when a network is down.
- We ran 15 live failure tests (F1 to F15), including spoofed accounts, forged and flooded Arkiv rows, replays and outages. They exposed real bugs that we fixed, such as a parallel double payment.