Chainwrit

Solana program · devnet

Spending limits for AI agents, enforced by Solana.

A human signs a mandate: who the agent may pay, how much per payment, how much per day, until when. Funds sit in a vault with no private key. The agent can only ask; the program decides.

The problem

One poisoned web page can drain an agent's wallet.

The key is the money

An agent that pays for things needs a private key. Whoever controls the key controls the funds.

Agents can be manipulated

Hidden text in a web page looks exactly like an instruction from the user. Models follow it.

Payments are final

On-chain transfers settle in seconds. There is no chargeback and no one to call.

A rule in the prompt is what injection attacks. A check on your server is skipped by whoever compromises it. The rule has to live somewhere the agent cannot reach.

How it works

The agent requests. The program decides.

Human
signs a mandate and deposits funds
↓create_mandate
Chainwrit program
mandate PDA + vault PDA (no private key)
  • ✓ not revoked
  • ✓ not expired
  • ✓ amount ≤ per-payment cap
  • ✓ merchant on allowlist
  • ✓ 24h spend ≤ daily cap
↓transfer
Merchant
paid only if every check passes
↓pay(amount, merchant) ↑
AI agent
holds a key that can only request payments
RuleWhat it meansWhat it stops
Merchant allowlistOnly addresses the human named can be paidPaying an attacker
Per-payment cape.g. at most 1 dUSDC per callOne large theft
Rolling 24h cape.g. at most 5 dUSDC per dayA slow drain of small payments
ExpiryThe mandate stops paying after a dateForgotten permissions
Instant revokeThe owner can stop it at any timeAn attack in progress
“Even if the agent is manipulated, its server compromised and its signing key stolen, funds cannot move outside the mandate.”
Attacker hasSo they controlWhat still holds
Prompt injectionThe agent's decisionsAllowlist and caps
Compromised serverThe agent's code and configAllowlist and caps
Stolen agent keyValid signatures for payAllowlist and caps
Rogue agent operatorEverything off-chainOwner can revoke and withdraw

Live on devnet

Don't take our word for it. Check the chain.

Approved: pay merchant A
View transaction ↗
Rejected: pay the attacker
View failed transaction ↗

The demo uses dUSDC, our own devnet test token. It has no value.

Built with

Boring, proven parts.