Skip to content
T

Treasury Guard

A dollar budget for AI agents, not a wallet key

Created on 31st October 2026

•

T

Treasury Guard

A dollar budget for AI agents, not a wallet key

The problem Treasury Guard solves

AI agents now pay for APIs, data and compute on their own. Giving an agent a wallet key is a blank cheque: one prompt injection or bug and the wallet is empty. Owners think in dollars, not sats, and need a hard limit the agent cannot talk its way around.

Treasury Guard gives the agent a dollar budget instead of a key.

How it works

  • Vault on BSV mainnet. The owner's sats sit in a script: (agent AND watcher) OR owner. The agent cannot spend alone. The owner can always exit alone, with no agent, no watcher and no Base transaction (proven on mainnet).
  • Budget on Base Sepolia. The agent buys a signed BSV/USD price from an API3 Airnode (CoinPaprika, paid over x402). TreasuryGuard.sol checks the signer, the request, the age (5 min) and replay, then turns dollars into a SPEND intent with a hard maxSats under a daily budget.
  • Watcher. It reads that intent from Base itself and checks the real BSV transaction byte by byte: vault inputs only, exactly one Agent Float output, change back to the same vault, the TGv1 receipt, outflow + fee ≤ maxSats. It journals the intent and only then co-signs. One transaction per intent; a replay gets HTTP 409. The watcher can block, never take.
  • Agent payment. The agent's model (DeepSeek or Claude) decides whether a purchase serves its task; a rule-based guardian enforces the merchant allowlist, the price and the caps; the agent pays an HTTP 402 API in sats from its float. settle(intent, txid) records the BSV txid on Base: a record, not a cross-chain proof.
  • DeFi rail. Atomic swap-and-pay turns sats into a token and pays a token-only merchant in one BSV transaction.

Who uses it, and how

A team runs a research or trading agent whose control logic lives on Base and gives it $1 a day. The owner funds the vault from BSV Desktop; the agent asks for budget with a signed price; the watcher releases exactly that much; the agent pays per call. A live dashboard shows each step: run the agent, refuse a replay, run the tamper test, exit alone.

What it brings to BSV

Agents pay small amounts, often. On mainnet a vault withdrawal cost about 40–80 sats in fees and an HTTP 402 payment 23 sats (≈ $0.000004). Treasury Guard brings agent teams and their budgets from an EVM chain to BSV micropayments without custody, using the BSV SDK, Wallet Toolbox, BEEF/SPV payments and BSV Desktop as the owner's wallet.

Signed data (API3)

  • Who relies on it: the vault owner. The signed BSV/USD price decides how many sats one dollar may release.
  • If it is forged: a lower price means more sats per dollar; a stale or replayed price lets the agent overspend. The contract refuses edited, stale, wrong-request and wrong-signer responses (tamper test: one valid, four rejected).
  • Data we could not find: a BSV/USD feed on Nodary, so we used CoinPaprika's Airnode.

Proof

Challenges we ran into

Two chains, no bridge. Base cannot see BSV, and BSV script cannot read Base. So we had to be exact about where each rule is enforced. The BSV script enforces the keys: agent + watcher together, or the owner alone. The watcher enforces the dollar limit: it reads the SPEND intent from Base itself and checks the raw transaction byte by byte. settle() on Base is a record, not a cross-chain proof. We proved the owner's exit on mainnet before we funded the agent path.

BSV

  • Fees grew with the vault inputs (intent 11). Several deposits gave the withdrawal several inputs, and the fee went past the fixed 100-sat reserve. The outflow went over maxSats and the watcher refused, which was correct. The reserve now grows with the number of inputs (about 19 sats each, measured).
  • HTTP 431 after paying (intent 12). The BEEF payment proof in the x-bsv-beef header was larger than Node's 16 KB header limit. The sats were paid but no data came back. The demo merchant now accepts headers up to 1 MB.
  • A deposit that was never broadcast (intent 13). BSV Desktop returned a txid, but the network never saw the transaction, and the watcher refused a coin WhatsOnChain did not know. Owner transactions are now checked on the network and posted again from the same signed BEEF, and a run spends only coins the watcher can see.
  • Crash safety. The watcher writes its journal (fsync, rename, checksum) before a signature leaves it, so one intent can never become two transactions. A replay gets HTTP 409.

API3

  • Freshness and replay. A signed price is fresh for 5 minutes and is accepted only once. So the tamper test runs checkPrice as a free eth_call on a judge vault that has the same Airnode, request and age rules and has never accepted a price.
  • A distinct WrongRequest error. A response for another feed (BTC/USD) only recovers an unrelated signer, so the contract checks the request hash before it recovers the signer.
  • Two laptops. The agent key that can create SPEND intents stays on the API3 laptop. The BSV laptop calls it through a small token-protected service. Its tunnel dropped twice (QUIC timeouts) until we switched it to HTTP/2.

Agent and scope

  • The model decides whether a purchase serves its task, but a model can be talked into anything. So the caps, the merchant allowlist and the price checks live in a rule-based guardian and in the watcher, not in the prompt.
  • We built a BSV-backed stablecoin (CDP) prototype, but we left it out. BSV script cannot see the debt or the price, so it would need a trusted watcher holding the collateral. That is custody, and this track requires funds that are not held in custody.

Tracks Applied (2)

DeFi Rails for Agentic Payments

BSV stack: @bsv/sdk (custom vault script, interpreter, BEEF/SPV), @bsv/wallet-toolbox (server wallets, permission guardi...Read More

BSV Association

Real-world data. Checked by your contract.

Essential: the signed BSV/USD price is the only way to turn the owner's dollar budget into a sats limit; without it no S...Read More

API3

Discussion

Builders also viewed

See more projects on Devfolio