Repository avatar
AI Tools
v0.2.0
active

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:

  1. It presents a valid Verified by Concordium badge (CIS-8004 Agent Registry: active on chain, card hash matches).
  2. 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.
  3. 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 ----------->|
ResponseMeaning
401 badge_missingNo badge header
403 badge_invalidBadge not registered, not active, or card hash mismatch
402 payment_requiredBadge is fine; x402 challenge returned
403 payer_not_bound_to_badgePayment signed by an account the badge does not name
429 owner_rate_limitedThe human behind the badge used up their allowance
200Paid and served; headers carry the payment and audit record

Concordium components used

ComponentUse
Agent Registry (CIS-8004) and Verified by Concordium badgeAdmission check on every request; source of the accountable owner
x402 on Concordium (@x402/concordium)Per-request payment in CCD or a PLT stablecoin
Sponsored transactionsThe gateway pays the fee, so an agent only needs the asset it pays in
On-chain data registrationAudit log head anchored as a RegisterData transaction

On testnet

WhatLink
Demo agent registration (token 1549, badge JyP9U8ewSjxyopPwq3PKf)transaction
Agent Card URL and hash pinnedtransaction
Paid request served by the gatewaytransaction
Audit head anchored (through record 9)transaction
First sponsored x402 paymenttransaction

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.

VariableDefaultMeaning
WARRANT_NETWORKtestnettestnet or mainnet
WARRANT_PAY_TOdemo merchantAccount that receives payments
WARRANT_SPONSOR_ADDRESS, WARRANT_SPONSOR_KEYdemo sponsorAccount that pays fees and anchors the log
WARRANT_PRICE, WARRANT_ASSET10000, CCDPrice in atomic units; asset may be a PLT symbol
WARRANT_MAX_PER_OWNER, WARRANT_WINDOW_MS2, 60000Served requests per owner per window
WARRANT_ANCHOR_EVERY5Anchor 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

  1. Price in a PLT stablecoin (already supported by the payment code; set WARRANT_ASSET).
  2. Read the registry contract directly from a node as a fallback to the hosted service.
  3. Move counters and the log to shared storage, and hold the sponsor key in a managed wallet (for example Dfns) with a spending cap.
  4. 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.