holdfast
OfficialHoldfast
The transaction firewall for AI agents that hold crypto.
Website · Demo video · Quick start · Security review
An AI agent with a wallet can be talked into sending money: a poisoned web page, a token name, a reply on X. Prompt filters don't stop it, because the attack is just text. Holdfast sits between the agent and the chain and checks what every transaction actually does before it is signed, so a hijacked agent can only do what its owner allowed.
Understands transactions, not just addresses. Decodes calldata (ERC-20, ERC-721, Permit, Permit2, EIP-3009, Uniswap V2/V3 including multicalls), simulates the result, values it in dollars and checks it against the owner's rules.
The agent never holds the key. Holdfast signs only what passes policy or what the owner approves. A fully compromised agent has nothing to sign around it with. The key can live in an encrypted keystore, AWS KMS or Turnkey, where even Holdfast never sees it.
Catches the scams that fool people. Address poisoning (look-alike addresses), known scam addresses, and calldata that costs more than the agent said it would are blocked outright.
A human for the big ones. Anything over a limit goes to the owner's phone with the simulated balance changes; one tap approves it, or rejects it and freezes the agent.
Works with the agent you already have. Claude Code, Cursor and other MCP agents get wallet tools in one line of config. Anything else points its Ethereum RPC URL at Holdfast; no wallet migration.
flowchart LR
A[AI agent<br/>no private key] -->|eth_sendTransaction| F
subgraph F[Holdfast]
D[Decode calldata] --> S[Simulate] --> P[Policy:<br/>limits, recipients,<br/>slippage, approvals]
P -->|allow| K[Sign with the key<br/>Holdfast holds]
P -->|over limit| H[Hold for owner]
end
H -->|Telegram / dashboard| O((Owner))
O -->|approve| K
O -->|reject| Z[Freeze agent]
K --> N[(Ethereum node)]
P -->|reject| X[Refused, logged]What it stops
The agent is tricked into… | What happens |
Approving an attacker to spend its tokens (on-chain or by signature) | Refused: spender not whitelisted, amount over the cap |
Sending funds to an unknown address | Refused: recipient not allowed |
A swap with a terrible guaranteed price (sandwich bait) | Refused: minimum output checked against market price |
A drain hidden inside a router multicall | Refused: every inner call is decoded |
Anything the simulation shows leaving to an unknown address, or reverting | Blocked before signing |
A large "urgent" payment | Held for the owner, with simulated balance changes |
Paying a look-alike of a trusted address (address poisoning) | Blocked: no approve button |
Paying a known scam address | Blocked, if a scam-address list is configured |
Calldata from an API or website that does more than the agent expected | Blocked: costs more than the agent's declared |
Buying a token the owner never listed (the memecoin rug) | Refused: swap output must be a listed token |
Signing a raw hash, or broadcasting a transaction it signed itself | Refused: it has no key, and raw signing is never served |
Anything at all, once the owner hits Reject | Every request refused until the owner unfreezes it |
Every decision is recorded with its reasons and shown live on the owner dashboard.
Measured, not just claimed. On agent-wallet-bench,
an open set of 47 cases anyone can run against their own agent wallet, Holdfast 0.10 stops
35/35 attacks, enforces 3/3 spending limits and lets 9/9 normal actions through, on a
mainnet fork with simulation on (full results).
Run it yourself with npm run bench:server.
Related MCP server: WETH
Quick start
Requires Node.js 22.13 or newer.
npm install
cp .env.example .env # set UPSTREAM_RPC_URL and SIGNER_KEYSTORE_PASSWORD
cp config/policies.example.json config/policies.json # one entry per agent
npm run keys:new -- keys/treasury-bot.json # prints the address: put it in agentAddress
npm run admin:token # dashboard token (shown once)
npm run devOpen http://localhost:8787/dashboard, then connect an agent.
MCP agents (Claude Code, Cursor, Claude Desktop, …)
npm run build
claude mcp add --env HOLDFAST_URL=http://localhost:8787/v1/rpc/treasury-bot --transport stdio holdfast \
-- node /path/to/holdfast/dist/mcp/stdio.jsThe agent gets wallet_address, get_balance, transfer_token, send_native,
send_transaction, sign_typed_data and check_approval. When something is blocked or waiting
for you, the tool result says so plainly and tells the model not to work around it. Setup for
other clients: docs/mcp.md.
Any other agent
Point its Ethereum RPC URL at its Holdfast endpoint and send unsigned transactions:
import { createWalletClient, http } from 'viem';
import { mainnet } from 'viem/chains';
const wallet = createWalletClient({
account: '0xYourAgentAddress', // address only: the agent has no key
chain: mainnet,
transport: http('http://localhost:8787/v1/rpc/treasury-bot', {
fetchOptions: { headers: { authorization: `Bearer ${process.env.AGENT_TOKEN}` } },
}),
});
await wallet.sendTransaction({ to, data, value }); // checked, signed and sent by HoldfastOr use the SDK, which turns every answer into an outcome the agent can act on:
import { HoldfastClient } from 'holdfast/sdk'; // inside this repo: ./src/sdk/client.js
const holdfast = new HoldfastClient({ url: 'http://localhost:8787/v1/rpc/treasury-bot', token: process.env.AGENT_TOKEN });
const outcome = await holdfast.transferToken(USDC, supplier, '250');
// { status: 'sent', hash } | { status: 'held', approvalId, … } | { status: 'blocked', reason, … } | { status: 'failed', reason }
if (outcome.status === 'held') await holdfast.waitForApproval(outcome.approvalId);To see it stop real attacks in five minutes on a local mainnet fork, follow DEMO.md.
Owner controls
Telegram: held requests arrive as a card with the decoded action, target, dollar value and simulated balance changes. Approve & Broadcast or Reject & Freeze Agent.
/unfreeze <agent>restores it.Dashboard: live activity with the reason behind every decision, requests waiting for approval, per-agent spend against limits, a freeze switch, and a rules editor whose changes apply to the next request. Off unless an admin token is configured; a read-only token lets someone watch without being able to act.
Chains
Ethereum, Base, Arbitrum and OP Mainnet have presets: "chain": "base" fills in the chain's
facts, and policies can name USDC, WETH, SwapRouter02 and Permit2 instead of pasting
addresses. Any other EVM chain works with addresses configured by hand.
Documentation
Every rule, setting, endpoint and error | |
Connecting Claude Code, Cursor, Claude Desktop and other MCP clients | |
Docker, HTTPS, health checks, production checklist | |
Security review: threat model, findings, fixes, residual risks | |
Reporting a vulnerability | |
Release history |
Development
npm test # vitest, no network
npm run typecheckThe suite includes property tests with random hostile input (test/fuzz.test.ts) and a red-team regression suite (test/redTeam.test.ts) with an attacker who
controls the agent's prompt, its signed bytes and its timing; every finding in AUDIT.md has a test.
License
Functional Source License 1.1, Apache 2.0 future license. You can use, modify and self-host Holdfast for anything except offering a competing product; each release becomes Apache 2.0 two years after it ships.
Available Tools
7 toolscheck_approvalCheck an approvalARead-only
Status of a request that is waiting for the owner: pending, broadcast (with the tx hash or signature), rejected, expired, failed or cancelled.
Inputs: approvalId (required).
get_balanceGet balanceBRead-only
Balance of the agent wallet: the native coin (omit token) or an ERC-20 token by contract address.
Inputs: token.
send_nativeSend ETHADestructive
Send the native coin (ETH) from the agent wallet. Amount in ETH, e.g. "0.05". Every transaction is checked by Holdfast against the owner's policy before it is signed. If a request is blocked, do not retry it in a different form or split it up; tell the user what was blocked and why.
Inputs: to (required), amount (required).
send_transactionSend a contract callADestructive
Send a raw contract call from the agent wallet (calldata already encoded). Prefer transfer_token or send_native for simple transfers. Every transaction is checked by Holdfast against the owner's policy before it is signed. If a request is blocked, do not retry it in a different form or split it up; tell the user what was blocked and why.
Inputs: to (required), data (required), value, max_spend_usd.
sign_typed_dataSign EIP-712 typed dataADestructive
Sign an EIP-712 message (orders, permits) with the agent wallet. Permits that let someone spend the wallet's tokens are checked like approvals. Every transaction is checked by Holdfast against the owner's policy before it is signed. If a request is blocked, do not retry it in a different form or split it up; tell the user what was blocked and why.
Inputs: typedData (required).
transfer_tokenTransfer an ERC-20 tokenADestructive
Send an ERC-20 token from the agent wallet. Amount is in whole tokens, e.g. "25.5". Every transaction is checked by Holdfast against the owner's policy before it is signed. If a request is blocked, do not retry it in a different form or split it up; tell the user what was blocked and why.
Inputs: to (required), token (required), amount (required).
wallet_addressWallet addressARead-only
The agent's wallet address. The private key is held by Holdfast, not by the agent.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct action: reading address/balance, three transfer paths, signing, and status polling. The only overlap is send_transaction vs transfer_token/send_native, but the description explicitly says to prefer the specialized tools for simple transfers, so the boundary is workable.
Six of seven tools follow a clean verb_noun pattern (get_balance, transfer_token, send_native, send_transaction, sign_typed_data, check_approval). The outlier is wallet_address, a bare noun property that breaks the convention, and two different verbs (send vs transfer) are used for the same class of operation.
Seven tools is well-scoped for a policy-gated signing wallet: one property read, one balance read, three send paths, one signing path, and one status check. Nothing feels padded or missing at the count level.
The surface covers the core lifecycle: identify wallet, read balance, sign/send, and poll approval status. Minor gaps remain: no transaction history or receipt lookup for already-broadcast txs, no way to list or enumerate pending approval requests (check_approval requires an id), and no token metadata lookup, though agents can work around these via raw contract calls.
Maintenance
Related MCP Connectors
Crypto wallet for AI agents: balances, payments, swaps and trading with owner controls.
Firewall for AI agents on Robinhood Chain: check transactions and signatures before signing.
EVM wallet reads, simulation, and transaction execution under user-defined authorization policies.
Pre-spend firewall for AI agents. Approves, blocks, flags transactions against policy rules.
Related MCP Servers
- AlicenseAqualityNot gradedmaintenanceNon-custodial agent wallet with a transaction preflight that decodes an unsigned EVM tx and flags drain patterns (unlimited/large approval, approve-all, token & NFT transferFrom, proxy upgrade, on-chain permit, approvals hidden in multicall) before signing.932 PyPI1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to analyze Ethereum wallets, simulate transactions, and draft transfers with deterministic policy and risk scoring, requiring human approval before on-chain execution.12 npmISC
- AlicenseNot gradedqualityDmaintenanceSecurity layer for AI agents that evaluates transaction intents and returns verdicts (ALLOW/WARN/DENY) using deterministic rules, on-chain checks, and simulation.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to score Solana tokens, simulate and decode transactions, and apply owner-defined limits, allowlists and slippage rules before anything is signed, returning a clear allow, confirm, block or freeze verdict. Also supports on-chain enforcement through a Squads multisig so an agent can propose trades but only execute when the gateway approves, with a kill-switch and owner approval flows for risky actions.MIT