Inspiration
The agentic economy is arriving faster than the infrastructure to support it. AI agents are already making autonomous spending decisions — procuring cloud compute, subscribing to data feeds, paying for API access — and the rails they're using offer zero governance. There's no policy enforcement layer, no privacy-tiered audit trail, and no cryptographic settlement that a third party can independently verify. We asked a simple question: if an AI agent decides to spend $50,000 at 2 AM, what stops it? The answer today is nothing. Eclipse is our answer to that gap — a policy-controlled Bitcoin treasury where the agent proposes, deterministic rules decide, and settlement is verifiable on-chain.
What it does
Eclipse is a policy-controlled Bitcoin treasury for AI agents. It enforces deterministic spending rules on every autonomous payment, settles approved transactions on Bitcoin testnet, and provides privacy-tiered audit trails for internal teams and external parties.
The core flow — Agent → Policy → Settlement:
Mission — An AI agent (powered by Gemini) evaluates vendors and proposes spending decisions with reasoning and confidence scores. Policy — A deterministic rules engine evaluates each proposal against configurable guardrails: per-transaction limits, daily spending caps, approved categories, approved vendors, escalation thresholds, and auto-approve ceilings. Route — The engine auto-approves, escalates to a human reviewer, or rejects. No ambiguity, no AI in the decision loop. Settle — Approved payments broadcast as real transactions on Bitcoin testnet, verifiable on mempool.space. When the on-chain wallet isn't funded, the same policy path enforces with SHA-256 preimage/hash cryptographic settlement.
Key features:
Dashboard with live treasury balance (reading from Bitcoin testnet wallet), daily spend vs. cap tracking, pending approvals, and policy violation alerts — all auto-refreshing. Create Policy page with configurable sliders for budget, per-tx limit, daily cap, escalation threshold, auto-approve ceiling, and allowed spending categories. Agent Missions where Gemini reasons through vendor payments, with every proposal evaluated by the policy engine before settlement. Privacy Traces — each payment has an internal invoice (full vendor, amount, category, Bitcoin address, explorer link) and an agent-facing invoice (payee redacted, category redacted, settlement reference redacted). Same transaction, two trust levels. Approval Queue for escalated payments with agent reasoning, escalation triggers, reviewer comments, and approve/reject controls — human-in-the-loop for anything above threshold. Transactions page with Internal View (full audit trail including SHA-256 hash and preimage verification) and Competitor View (all sensitive data hashed). On-chain verification — treasury address viewable on mempool.space with balance history showing sats leaving the wallet as agents spend. Export & Compliance — CSV export of the full ledger and printable treasury report with every transaction, vendor, amount, category, status, and payment hash. Eclipse Help — in-app AI assistant that explains policy and treasury operations.
How we built it
Backend: Hono HTTP API in TypeScript (ESM), running on port 4000. The policy engine (policy-engine.ts) evaluates every payment request against the agent's policy and budget with deterministic rule ordering — category check, per-tx limit, daily cap, budget ceiling, vendor allowlist, escalation threshold, and auto-approve ceiling. Settlement is handled in lightning.ts which routes to either real Bitcoin testnet broadcast (via bitcoinjs-lib, ecpair, and Blockstream's testnet API) or SHA-256 preimage/hash simulation. Agent missions call Gemini (google/gemini) to reason through vendor decisions, with each proposed payment fed back through the policy engine. Frontend: Next.js with App Router, calling the backend via REST. The UI includes the dashboard, policy creation with live rule preview, agent management and mission execution, approval queue, transactions with internal/competitor view toggle, privacy traces, settlement invoices, and exportable reports. Database: Supabase Postgres with tables for workspaces, agents, budgets, policies, payment requests, approvals, transactions, audit logs, and treasury top-ups. All policy decisions and outcomes are logged for full auditability. Bitcoin integration: bitcoinjs-lib for transaction construction, Blockstream testnet API for UTXO fetching and broadcast, mempool.space for explorer links. Treasury key loaded from TREASURY_WIF env variable; each vendor payment creates a fresh random P2WPKH testnet address as the payee.
Challenges we ran into
Dual settlement modes: Getting the on-chain Bitcoin path and the simulated preimage path to share the same policy enforcement, audit trail, and UI code without diverging was a significant architecture challenge. The executePayment entry point needed to gracefully fall back to simulation when testnet conditions weren't met, without breaking the demo flow. Policy engine determinism: Ensuring the daily cap calculation was accurate required joining live transaction data with the current payment request, scoped to the correct agent and time window. Edge cases around midnight rollovers and concurrent requests took careful handling. Privacy layering: Building two views of the same transaction — full internal audit vs. redacted external — through a single data model required careful separation of public_trace and private_metadata in the JSONB columns, not separate tables. Testnet reliability: Bitcoin testnet UTXO availability and Blockstream API rate limits introduced intermittent failures during demo runs. We built automatic fallback to simulation mode so the demo never hard-breaks in front of judges.
Accomplishments that we're proud of
Real Bitcoin testnet transactions that judges can independently verify on mempool.space — not a mockup, not a database entry. A deterministic policy engine where the same inputs always produce the same approve/escalate/reject outcome — no AI hallucination in the governance layer. Privacy-tiered invoices that solve a real enterprise problem: how do you give your internal treasury team full visibility while giving agents and external parties only what they need? The entire system — policy engine, AI agent integration, on-chain settlement, privacy controls, approval workflows, exportable reports — built in 36 hours.
What we learned
Bitcoin's UTXO model is surprisingly well-suited to programmatic treasury management — each payment is a discrete, verifiable state transition. The hard problem in agentic spending isn't the payment rail — it's the governance layer that sits in front of it. Getting policy evaluation right (rule ordering, edge cases, fallback paths) took more engineering time than the settlement integration. Privacy in financial systems isn't binary. The internal/external split we built reflects how real treasury teams already think about disclosure — and having it built into the protocol layer from day one matters more than bolting it on later.
What's next for Eclipse
Lightning Network integration — add real LN settlement as an alternative rail alongside on-chain, enabling instant micropayments for high-frequency agent spending. Multi-signature treasury — move from single-key to multi-sig (2-of-3) for production-grade key management. Policy marketplace — pre-built policy templates for common agent use cases (cloud procurement, data subscriptions, API access). Mainnet readiness — the architecture is testnet-only by design for the hackathon, but the policy engine and privacy layer are chain-agnostic and ready to point at mainnet.
Built With
- bitcoin
- blockchain
- concurrently
- ecpair
- google-gemini
- hono
- next.js
- node.js
- postgresql
- supabase
- tailwind-css
- typescript
- vitest
Log in or sign up for Devpost to join the conversation.