SERV Hackathon 02 · Kite track Record signed Base mainnet · USDC GitHub

The log format.

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.

The spec

The record

{
  "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&currency=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.

The hash rule

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.

Writing one

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&currency=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",
});

Getting it checked

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.

If you do not write in this format

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 needsWhere it looks
the priceprice_usd · amount_usd · cost_usd · price · cost · cost.usd · amount
the transactiontx_hash · tx · transaction_hash · settlement.tx · payment.tx
the chainchain · network · settlement.network · payment.network
the endpointservice · name · provider · endpoint.name · target.provider · merchant
the refusalkind · action · status · outcome · error_code · error.code
the budgetsession · 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"