Powered by Midnight Network

MidPilot
Privacy-First AI Financial Copilot

AI agents can safely request cryptocurrency payments without ever holding your keys. Spending policies are enforced by zero-knowledge smart contracts on-chain.

Get Started
Requires Node.js v20+ Docker Ollama
How It Works

Four steps from request to settlement

You talk naturally. MidPilot plans, validates, and executes. Every transaction is enforced by ZK proofs — no trust required.

1

You Speak

Type a request in plain English: "Send 50 NIGHT to Starbucks."

2

AI Plans

The agent breaks it into tasks, estimates budgets, and asks for approval.

3

Policies Check

Local pre-check + on-chain ZK contract verify limits, merchants, and time.

4

Settlement

Approved transactions execute real on-chain transfers via MCP wallet.

Features

Built for privacy, designed for trust

🧠

Local AI

Ollama + Qwen2.5 runs entirely on your machine. Zero API calls, zero data leakage, zero recurring cost.

🔒

ZK Enforcement

Spending policies live on-chain as Compact smart contracts. The AI proposes, the contract disposes.

Real Transfers

Execute actual on-chain transactions through the MCP wallet. No simulation, no test tokens only.

🏕

Full Privacy

Your private keys never leave your wallet. The AI only sees what you choose to disclose via ZK proofs.

Tech Stack

What's under the hood

LayerTechnology
RuntimeNode.js v26 + TypeScript
AI EngineOllama + Qwen2.5 (local, zero API cost)
BlockchainMidnight Network (Compact smart contracts)
Walletnel349/midnight-wallet-cli via MCP server
DatabaseSQLite via sql.js (pure JS, no native build)
DashboardVanilla JS + WebSocket (real-time updates)
TestingVitest (20 unit tests)
LocalnetDocker (node, indexer, proof-server)
Quick Start

Up and running in minutes

Node.js v20+ Docker Desktop or Engine Ollama installed locally
Install dependencies
npm install
Start Midnight localnet
midnight localnet up
Start Ollama and pull the model
ollama serve
ollama pull qwen2.5:3b
Initialize MidPilot
# Interactive wizard
npx tsx src/cli/index.ts init

# Demo-friendly defaults
npx tsx src/cli/index.ts init --demo

# Standard defaults
npx tsx src/cli/index.ts init --defaults
Start chatting
npx tsx src/cli/index.ts chat
Reference

CLI commands

CommandDescription
initInitialize policies (interactive wizard)
init --demoUse demo-friendly policies
init --defaultsUse standard defaults
init --resetReset policies and re-run wizard
chatStart AI chat session
chat --no-dashboardChat without web dashboard
statusShow wallet, contract, and policy status
dashboardStart web dashboard only
policy listList active policies
policy freezeEmergency freeze all spending
policy unfreezeUnfreeze spending
Demo

What it looks like in action

Successful Transfer Approved
You: Send 50 NIGHT to mn_addr_undeployed1jure...56u

MidPilot: Transfer completed.
  TX Hash: 00d64003d9d206ff21b52dbb12d22835e12556d...
  Amount: 50 NIGHT
  Balance: 19,950 NIGHT remaining
Daily Limit Exceeded Rejected
You: Send 1500 NIGHT to merchant_amazon

MidPilot: Payment rejected.
  Reason: Daily limit exceeded (limit: 1000 NIGHT, requested: 1500 NIGHT)
  Please try again tomorrow or reduce the amount.
Emergency Freeze Frozen
You: Freeze all spending

MidPilot: Emergency freeze activated. All transactions are now blocked.
  Run "policy unfreeze" to resume.
Mission Planning Mission
You: Build me a Discord bot

MidPilot: Mission Detected
  Discord Bot

  Required Resources:
  - Hosting (3 NIGHT)
  - API Access (2 NIGHT)
  - Deployment (1 NIGHT)

  Estimated Budget: 6 NIGHT

  Would you like to allocate 6 NIGHT to this mission?
Architecture

How the system fits together

User | v Chat Interface ----> Web Dashboard (localhost:3000) | v AI Agent (Ollama + Qwen2.5, local) | +----+----+----+ | | | | v v v v Policy Wallet Contract SQLite Engine MCP Manager Audit Log | | | | v v v v policies.json midnight-wallet-mcp Compact contract midpilot.db (disk) (Docker) (ZK) (disk) 9 Modules | 34 Source Files | 20 Unit Tests
Privacy Model

Your data never leaves your machine

🔒

No key exposure. The AI communicates via MCP protocol — it never touches your private keys.

On-chain enforcement. ZK proofs guarantee policy compliance — the contract is the final arbiter.

👁

Selective disclosure. disclose() reveals only what's needed — nothing more.

🏕

Local execution. Ollama, Docker, SQLite — everything runs on your machine. No cloud.

Policies

Four layers of spending control

PolicyWhat It Does
daily_limitCap spending per day (e.g., max 1000 NIGHT/day)
merchant_whitelistOnly approved recipients can receive funds
time_restrictionRestrict transactions to allowed days and hours
emergency_freezeKill switch — instantly block all transactions

Policies are stored in .midpilot/policies.json and persist between sessions. Freeze/unfreeze takes effect immediately.