The problem
AI agents now hold real money, and people talk them out of it. In May 2026 a message posted on X got an agent to echo a transfer command, and its wallet automation sent about $150,000 in tokens. Prompt-injection games exist, but players have to trust that the developer runs the agent honestly, and the attack data stays private.
Bulkhead is a firewall and a contract-enforced spending cap for agents that hold money. It’s being built around Drain Me, an arena where three AI agents will guard BTC and USDC in a NEAR vault while players try to talk them into paying out. Every attempt is planned to go into an open dataset that measures the firewall’s block rate. So far it runs on testnet only.
What I built
Bulkhead is a two-person build for the NEAR Hackathon (November 1–14, 2026), still in progress. Farouk owns the agent, firewall and web app. I own the chain side:
- The vault contract (Rust, near-sdk). It holds each tier’s funds, enforces the spending cap, cooldown and number of rounds, and only accepts calls from an agent running approved code.
- The payout path. The contract builds the real Bitcoin or Base USDC transaction itself and sends it to NEAR’s chain signature service (MPC) to sign.
- Time-locked owner powers. Approving new agent code and emergency withdrawals both wait 24 hours, and pending actions are public.
- Deploy scripts and the Bitcoin testnet spike that proved the payout path end to end.
- Player message one attempt, up to 2,000 characters
- Agent in a TEE firewall checks the input and the action (tier 3)
- Vault contract spending cap, cooldown, rounds, approved code only
- Chain signatures MPC signs the transaction the contract built
- Bitcoin or Base payout broadcast
Key decisions
- The contract builds the transaction, not the agent. If the agent built the transaction and the contract only signed it, a tricked agent could hide a bigger payout inside it. The contract assembles the payout itself, so the cap applies to what is actually sent.
- Bitcoin checks the amount for us. An agent could lie about how much a Bitcoin input holds to sneak under the cap. Bitcoin’s signature format commits to the input amount, so a signature over a false amount is invalid. I tested this on testnet: the payout signed with a false amount was rejected, and the true one went through.
- One asset per tier. Each tier holds a single asset, so each release needs one transaction builder and no multi-asset payout logic.
- Owner powers wait 24 hours. New agent code and emergency withdrawals are proposed first and executed a day later, so players can see any change coming.
What went wrong
The plan had a hard deadline: a contract-signed Bitcoin testnet transaction by November 6, or the first working payout would move to Base. The spike met it on November 2. Getting there meant matching the exact request format the signer expects. The local test signer now rejects any other format, so tests catch the mistake.
Results
- The vault contract signed a real Bitcoin testnet payout through NEAR’s chain signatures (transaction). Bitcoin rejected the same payout signed with a false input amount.
- 77 unit tests and 7 sandbox tests pass.
- The contract has not been reviewed yet, so it is not on mainnet. The code goes public when the hackathon ends on November 14.