Loops HouseBastionKey

NEAR HACKATHON
Links
Team
1 member- CHOwner
Chinonso Onuorah
Overview
Problem: AI agents need to pay for APIs, compute and services, but handing them a wallet key gives full access. Spending caps help, yet they don't read intent: a prompt injection can redirect a small, in-budget payment to an attacker.
What I built: BastionKey, a NEAR smart contract (Rust, near-sdk 5) that sits between an agent and its wallet. The agent holds only a NEAR Function Call Key limited to request_signature, so it has no private key on any chain. The contract enforces rules the owner sets: per-transaction cap, rolling hourly budget, recipient/token/chain allow-lists, gas cap, replay guard and a velocity circuit breaker. It builds the EIP-1559 transaction bytes itself, so the agent can't describe one payment and get another signed. For risky transfers it also needs a signed verdict from a NEAR AI Cloud model saying the payment matches the human's task. The contract recovers that signature on-chain, checks it against the pinned signer, and binds it to the exact transaction digest. Also included: a TypeScript client, a CLI (bastion pay / doctor) and a live dashboard.
How NEAR fits: Function Call Keys give the agent a limited identity. The policy contract runs on NEAR. NEAR Chain Signatures (MPC) sign the Base Sepolia transaction only if the contract approves, so no EVM key ever exists in the agent. NEAR AI Cloud supplies the intent check.
Proof: contract live on testnet (bastion-guard.testnet). Three real runs: an approved payment with a Base Sepolia tx, a $150 request rejected on-chain, and a prompt injection blocked. 26 Rust and 36 TypeScript tests pass.
Limits: testnet prototype, not audited. The TEE hardware quote isn't independently verified, and only ERC-20 transfers are supported.