One JSON object per line, each committing to the one before it. Write it in any shape you like and Capsule will still check your payments; the hash chain is the bonus for people who want it.
{
"seq": 0,
"at": "2026-11-12T05:12:03.114Z",
"decision": {
"kind": "purchase",
"service": "Agent402 Tools /api/crypto-price",
"url": "https://agent402.tools/api/crypto-price?coins=ETH¤cy=usd",
"price_usd": "0.001",
"asset": "USDC",
"chain": "eip155:8453",
"tx_hash": "0xf222835b302b905f6d00c5e620cfc59a7b97c1f1d9672eb4c9cdd682e3ecde4e",
"reason": "covers the current price and 24h change",
"fact": "current ETH price and 24h change"
},
"session": {
"id": "agent_session_01a1ce43-9ea9-7025-a2a1-56d7734327cb",
"max_amount_per_tx": "0.002",
"max_total_amount": "0.0025"
},
"hash": "0xd6af6f6b610a8f1410ed38ea66742a3bd772fbc05543164c51f8779655c08839",
"prev": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
A refusal record has the same shape with
kind: "refusal", no tx_hash, and the Passport's own
error_code and message instead. A refusal is what
makes a record worth publishing.
Each record's hash is
keccak256(utf8(JSON.stringify(payload))), where the payload is the
record's seq, at, decision,
prev and, if the record carries one, session, in
that key order. The order is part of the format, because the
hash is taken over exactly that JSON.
prev is the previous record's hash; the first record's
prev is 64 zeroes. Change any earlier decision and every hash after
it stops matching, and the verifier says which record broke.
The writer is one file with no framework in it, and it is in this repository:
docs/log-writer.mjs. It needs
viem and nothing else.
import { DecisionLog } from "./log-writer.mjs";
const log = new DecisionLog({ path: "decision-log.jsonl" });
await log.append({
kind: "purchase",
service: "Agent402 Tools /api/crypto-price",
url: "https://agent402.tools/api/crypto-price?coins=ETH¤cy=usd",
price_usd: "0.001",
asset: "USDC",
chain: "eip155:8453",
tx_hash: "0x...",
reason: "covers the current price",
fact: "current ETH price and 24h change",
}, {
id: "agent_session_...",
max_amount_per_tx: "0.002",
max_total_amount: "0.0025",
});
Publish the file anywhere that serves it over https and hand the
URL to whoever needs to see it:
https://capsule-phi-blond.vercel.app/verify?log=https://your.host/decision-log.jsonl
Or in JSON:
curl "https://capsule-phi-blond.vercel.app/verify?log=https://your.host/decision-log.jsonl&format=json"
Nothing is stored. Capsule fetches the file, checks it, reads the payments off the chain, and answers.
Your payments are still verified. The reader is tolerant: it looks for the fields it needs under the names other systems use, one JSON object per line.
| What it needs | Where it looks |
|---|---|
| the price | price_usd · amount_usd · cost_usd · price · cost · cost.usd · amount |
| the transaction | tx_hash · tx · transaction_hash · settlement.tx · payment.tx |
| the chain | chain · network · settlement.network · payment.network |
| the endpoint | service · name · provider · endpoint.name · target.provider · merchant |
| the refusal | kind · action · status · outcome · error_code · error.code |
| the budget | session · limits · policy, with max_amount_per_tx and max_total_amount |
A field it cannot find is left empty, never guessed. A price that is not a number is not a price.
There is a worked example. The same two payments and two refusals as our recorded run, written in a flat schema with no hash chain and different key names, and verified exactly as ours are:
https://capsule-phi-blond.vercel.app/examples/foreign-log.jsonl
curl "https://capsule-phi-blond.vercel.app/verify?log=https://capsule-phi-blond.vercel.app/examples/foreign-log.jsonl&format=json"