
checks
app.vercel.warrant-agent-check/checks
Paid checks before an agent pays: x402 seller preflight, Base address facts, Concordium badge.
Documentation
Warrant
A gateway that API owners put in front of a paid endpoint so it only serves AI agents with an accountable human behind them.
An agent is served when all three hold:
- It presents a valid Verified by Concordium badge (CIS-8004 Agent Registry: active on chain, card hash matches).
- It pays for the request over x402, and the payment comes from the account that owns the badge or the agent wallet registered on chain. Paying is the proof of control: copying someone's badge string gets you nothing.
- The badge's owner is inside their limits. Limits are per accountable human, not per agent, so minting more agents buys nothing.
Every outcome, served or refused, goes into a hash-chained audit log whose head is written on Concordium, so the operator cannot quietly rewrite history.
Built for the Concordium Trusted Agents Hackathon. Runs on Concordium testnet. Watch the 90-second demo.
Request flow
agent Warrant Concordium
| GET /v1/report | |
| warrant-agent: <badge> |-- check badge (Agent Registry)->|
|<-- 402 PAYMENT-REQUIRED ---| |
| sign transfer (no fees) | |
| GET + PAYMENT-SIGNATURE -->| payer == badge owner/wallet? |
| |-- sponsor, submit, finalize --->|
|<-- 200 + PAYMENT-RESPONSE -|-- anchor audit head ----------->|
| Response | Meaning |
|---|---|
401 badge_missing | No badge header |
403 badge_invalid | Badge not registered, not active, or card hash mismatch |
402 payment_required | Badge is fine; x402 challenge returned |
403 payer_not_bound_to_badge | Payment signed by an account the badge does not name |
429 owner_rate_limited | The human behind the badge used up their allowance |
| 200 | Paid and served; headers carry the payment and audit record |
Concordium components used
| Component | Use |
|---|---|
| Agent Registry (CIS-8004) and Verified by Concordium badge | Admission check on every request; source of the accountable owner |
x402 on Concordium (@x402/concordium) | Per-request payment in CCD or a PLT stablecoin |
| Sponsored transactions | The gateway pays the fee, so an agent only needs the asset it pays in |
| On-chain data registration | Audit log head anchored as a RegisterData transaction |
On testnet
| What | Link |
|---|---|
Demo agent registration (token 1549, badge JyP9U8ewSjxyopPwq3PKf) | transaction |
| Agent Card URL and hash pinned | transaction |
| Paid request served by the gateway | transaction |
| Audit head anchored (through record 9) | transaction |
| First sponsored x402 payment | transaction |
Use it
import { Hono } from "hono";
import { warrant } from "./src/gateway";
app.get("/v1/report", warrant({ registry, settler, audit, policy }), (c) =>
c.json({ servedTo: c.get("agent").ownerAccount }),
);
See src/server.ts for the full wiring.
Run the demo
Needs Node 20+ and Bun. Everything below is testnet only.
bun install
npx tsx scripts/identity.ts # test identity from the testnet identity provider
npx tsx scripts/accounts.ts # agent, merchant and sponsor accounts; fund them from the testnet faucet
npx tsx scripts/register.ts # mint the agent in the Agent Registry
npx tsx scripts/card.ts --pin # build the Agent Card and pin its URL and hash (edit CARD_URL to where you host it)
WARRANT_ANCHOR_EVERY=1 bun run dev # gateway on :4021
bun run demo # runs every outcome in the table above
bun test # unit tests, no network
Keys are written to keys/, which is git-ignored. GET /audit returns the records, the chain check and the anchor transactions.
| Variable | Default | Meaning |
|---|---|---|
WARRANT_NETWORK | testnet | testnet or mainnet |
WARRANT_PAY_TO | demo merchant | Account that receives payments |
WARRANT_SPONSOR_ADDRESS, WARRANT_SPONSOR_KEY | demo sponsor | Account that pays fees and anchors the log |
WARRANT_PRICE, WARRANT_ASSET | 10000, CCD | Price in atomic units; asset may be a PLT symbol |
WARRANT_MAX_PER_OWNER, WARRANT_WINDOW_MS | 2, 60000 | Served requests per owner per window |
WARRANT_ANCHOR_EVERY | 5 | Anchor after this many new records |
Verifying the audit log
Each record holds the SHA-256 of the previous one. An anchor transaction carries warrant/v1, the record count and the head hash. To audit: recompute the chain from GET /audit (verifyChain in src/audit.ts), then compare the hash at each anchored position with the data in the anchor transaction. Any edit, deletion or reorder before an anchor changes that hash.
Limits of this version
- The audit log proves records were not changed after anchoring. It does not prove the operator logged every request.
- A badge shows an accountable owner exists; it does not reveal who they are. Disclosure goes through Concordium's identity layer and its legal process.
- Rate-limit counters are in memory and the log is a local file; one gateway instance only.
- The badge check uses Concordium's hosted Agent Registry service. If it is unreachable, requests are refused, not waved through.
Path to mainnet
- Price in a PLT stablecoin (already supported by the payment code; set
WARRANT_ASSET). - Read the registry contract directly from a node as a fallback to the hosted service.
- Move counters and the log to shared storage, and hold the sponsor key in a managed wallet (for example Dfns) with a spending cap.
- Ship as an npm package with Hono and Express adapters, and a hosted version where API owners pay a small share of each settled request.
No installation packages available.