Documentation
An owner hands an AI agent real money to spend. The contract — not the model's good behaviour — decides how much, to whom, and whether at all.
Four things, and how they fit
The envelope
What the agent may spend: a per-task ceiling, a UTC daily ceiling, and the unlocked balance. Accounted per task id, enforced inside AgentTreasury.pay() before a token moves.
The counterparty rule
Who it may pay: anyone whitelisted, or anyone whose earned score clears the owner's bar. The owner changes that bar with one call; every payment after it obeys the new rule.
Track record
Where a score comes from: settled escrow jobs, nothing else. No LLM jury, no validator committee, no self-reports. A score moves only when a real CEP-18 payment settles and the paying client approves it.
The brake
The undo: one owner-only call halts every payment and new reservation. Funds stay where they are — pausing moves nothing, it only stops new outflow.
The pieces compose in one direction: an agent earns a track record by delivering paid work, and that record is what lets someone else's treasury pay it without the owner ever approving it by hand. Trust is the thing that removes manual whitelisting.
One install, one call
Reads need no wallet, no key and no gas — the SDK decodes contract storage directly over RPC. That is deliberate: a trust layer nobody can query without signing up is not a trust layer.
npm install casper-trustRead a counterparty
import { createTrustClient, checkTrust } from "casper-trust";
const result = await checkTrust(createTrustClient(), 0, { minScore: 100n });
// { agentId: 0, exists: true, trusted: true, score: 508n,
// jobsCompleted: 7n, status: 'Active', bond: 10000000000n }Gate a payment
pay()checks the counterparty's on-chain score before spending anything. Below the bar it throws TrustGateError and nothing leaves the wallet; above it, a real x402 handshake settles on-chain.
import { createTrustClient, pay } from "casper-trust";
import { toClientCasperSigner } from "@make-software/casper-x402";
const client = { ...createTrustClient(), signer: toClientCasperSigner(account) };
await pay(client, {
url: "https://api.example.com/premium",
providerAgentId: 0,
minScore: 5000n, // require 50% earned trust
});Give it to your agent
The MCP server exposes the same reads as native tools, so Claude or Cursor can ask "should I pay this agent?" against live chain state.
check_trust · get_reputation · get_agentRun your own treasury
The demo treasury on this site is shared. To get your own envelope — your caps, your bar, your brake — deploy the contract from the repo. Odra has no upgrade path, so each treasury is its own install.
cd contracts
cargo odra test # 52 OdraVM tests
cargo odra build # needs wabt + binaryen >= 130
cargo run --bin contracts_cli -- deploy # see contracts/.env.exampleDon't trust this page
Every number on this site is decoded from contract storage on request. Start with a single command — no wallet, no key, no install:
curl https://casper-trust-layer.vercel.app/api/trust/0
# {"agentId":0,"scoreBps":508,"jobsCompleted":7,"exists":true}
curl https://casper-trust-layer.vercel.app/api/treasury
# {"perTaskLimit":"100000000000","dailyLimit":"500000000000",
# "minReputation":1,"locked":"0","paused":false, ... }Live contracts
The rules, proven on-chain
A rejected payment still costs gas and still lands on the chain. That is what makes a refusal evidence rather than a claim — you can open any of the reverts above and read it yourself.