The First LLM-Powered Privacy-Preserving DeFi Agent on Solana
All code in this repository was written by an AI agent (Claude) for the Solana Agent Hackathon. Every line of TypeScript, Rust, and Circom.
Makora is not a trading bot. It's an autonomous DeFi agent that thinks with LLMs, reads prediction markets, and protects your privacy on Solana.
| Feature | Makora | Typical DeFi Bots |
|---|---|---|
| Intelligence | LLM-powered (Anthropic/OpenAI/Qwen) + Polymarket signals | Simple rules |
| On-chain programs | 3 Anchor programs | 0 (API-only) |
| Zero-knowledge privacy | Stealth addresses + shielded transfers | None |
| Decision framework | OODA loop with AI reasoning | If/else logic |
| Market intelligence | Polymarket prediction markets + DeFi yields | Price feeds only |
| Risk management | Circuit breaker + absolute VETO | Basic limits |
| Solana-native | 100% | Often EVM-first |
| Agent-to-Agent API | REST API for composability | None |
| NL interface | Parse natural language commands | Commands only |
| Interfaces | CLI + Dashboard + Telegram + REST API + Worker | Single interface |
| BYOK | Bring Your Own Key -- user's LLM API key, zero lock-in | N/A |
You: "swap 10 SOL to USDC"
Makora:
1. OBSERVE - Fetches portfolio, prices, on-chain positions
2. ORIENT - LLM analyzes market data + Polymarket signals + yields
→ "Neutral sentiment, 65% confidence. SOL range-bound,
recommend 40% stake, 30% lend, 20% LP."
3. DECIDE - Strategy evaluation + risk manager validation (VETO power)
4. ACT - Executes on-chain via stealth session wallets
Result: TX confirmed at slot 312,847,291
Makora's ORIENT phase is powered by real LLM reasoning instead of hardcoded rules:
- Bring Your Own Key (BYOK) -- Anthropic (Claude), OpenAI (GPT), or Qwen
- Polymarket Integration -- Prediction market signals as forward-looking sentiment
- Structured Analysis -- LLM outputs JSON: sentiment, allocation, risk assessment, reasoning
- Transparent Reasoning -- Every decision shows the LLM's chain of thought in the dashboard
- Graceful Fallback -- If the LLM fails, the deterministic strategy engine takes over
- Swaps via Jupiter (real aggregation across Raydium, Orca, Lifinity, Meteora, Phoenix)
- Staking via Marinade (SOL -> mSOL liquid staking, ~7.2% APY)
- Lending via Kamino (USDC/SOL lending vaults)
- LP via Raydium (concentrated and standard liquidity)
- Privacy via ZK proofs (stealth addresses + shielded transfers)
- Advisory -- Makora analyzes with LLM reasoning, you approve
- Autonomous -- Makora executes within risk limits (circuit breaker protected)
User's API Key (localStorage, never leaves browser)
|
Dashboard (Vercel) --POST /api/llm/analyze--> LLM Provider (Anthropic/OpenAI/Qwen)
| |
v v
useOODALoop Structured LLMAnalysis
+----------+ +-------------------+
| OBSERVE |<-- on-chain portfolio | sentiment |
| ORIENT |<-- yields + Polymarket + LLM --> | allocation[] |
| DECIDE |<-- risk manager validation | risk assessment |
| ACT |--> stealth session execution | reasoning chain |
+----------+ +-------------------+
|
Backend Worker (Railway) -- same OODA loop, runs 24/7
graph TB
subgraph Interfaces
CLI[CLI - 7 Commands]
TG[Telegram Bot]
API[REST API - 10 Endpoints]
DASH[Web Dashboard]
WRK[Backend Worker - 24/7]
end
subgraph Agent Core
NL[NL Parser]
OODA[OODA Loop]
LOG[Decision Log]
end
subgraph Intelligence
LLM[LLM Provider - BYOK]
PM[Polymarket Feed]
SE[Strategy Engine - Fallback]
MA[Market Analyzer]
YO[Yield Optimizer]
RB[Rebalancer]
end
subgraph Safety
RM[Risk Manager]
CB[Circuit Breaker]
end
subgraph Execution
EE[Execution Engine]
SM[Session Manager - Stealth]
TB[TX Builder]
CT[Confirmation Tracker]
end
subgraph Protocols
JUP[Jupiter - Swap]
MAR[Marinade - Stake]
RAY[Raydium - LP]
KAM[Kamino - Lend]
PRV[Privacy - ZK Shield]
end
subgraph On-Chain Programs
V[makora_vault]
S[makora_strategy]
P[makora_privacy]
end
CLI --> NL
TG --> NL
API --> NL
DASH --> OODA
WRK --> OODA
NL --> OODA
OODA --> LLM
OODA --> PM
OODA --> SE
LLM --> OODA
PM --> OODA
SE --> MA
SE --> YO
SE --> RB
OODA --> RM
RM --> CB
OODA --> EE
EE --> SM
EE --> TB
EE --> CT
EE --> JUP
EE --> MAR
EE --> RAY
EE --> KAM
EE --> PRV
JUP --> V
MAR --> V
PRV --> P
SE --> S
+===========+
| OBSERVE | Fetch portfolio, prices, yields, positions
+===========+
| ORIENT | LLM analysis + Polymarket signals + strategy engine
+===========+
| DECIDE | Risk validation (5 checks, VETO power)
+===========+
| ACT | Execute via stealth session wallets
+===========+
~ repeat every 60 seconds (auto mode)
# Prerequisites: Node.js 20+, pnpm 8+
# Clone
git clone https://github.com/IsSlashy/Makora.git
cd Makora
# Install
pnpm install
# Build all packages
pnpm build
# Start dashboard (the primary interface)
cd apps/dashboard && pnpm dev
# Open http://localhost:3000
# Click gear icon -> configure your LLM API key -> watch the agent think
# Set up wallet (if you don't have one)
solana-keygen new
# Run CLI
cd apps/cli && node dist/index.js status
# Start headless worker (24/7 agent)
LLM_PROVIDER=anthropic LLM_API_KEY=sk-... LLM_MODEL=claude-sonnet-4-20250514 \
node apps/worker/dist/index.js# .env file
SOLANA_NETWORK=devnet
SOLANA_RPC_URL=https://api.devnet.solana.com
HELIUS_API_KEY=your_helius_key # Optional: faster RPC
WALLET_PATH=~/.config/solana/id.json
TELEGRAM_BOT_TOKEN=your_telegram_token # For Telegram bot
PORT=8080 # For API server
# LLM config (for worker -- dashboard uses BYOK via Settings panel)
LLM_PROVIDER=anthropic # anthropic | openai | qwen
LLM_API_KEY=your_llm_api_key
LLM_MODEL=claude-sonnet-4-20250514The dashboard is the primary interface for judges. Features:
- TheWheel -- OODA loop phase visualization with kanji symbols
- Portfolio Card -- Real-time portfolio value from connected wallet
- LLM Reasoning Panel -- Live display of LLM analysis: sentiment, allocation, key factors, warnings
- Polymarket Panel -- Crypto prediction markets with probability bars, volume, 24h change
- Strategy Panel -- Active strategy with recommended allocation and blended APY
- Activity Feed -- Live log of agent actions with on-chain TX signatures
- Risk Controls -- Interactive sliders for position limits, slippage, circuit breakers
- Settings Panel -- BYOK: choose provider, enter API key, select model, test connection
- Stealth Sessions -- Privacy session status from on-chain vault state
Click the gear icon in the header to configure:
- Provider: Anthropic (Claude) / OpenAI (GPT) / Qwen
- API Key: Stored in localStorage only -- never touches our servers
- Model: claude-sonnet-4-20250514, gpt-4o-mini, qwen-plus, etc.
- Temperature: 0.0 (precise) to 1.0 (creative)
- Polymarket: Toggle prediction market intelligence on/off
- Test Connection: Validates your key works before saving
All commands execute real transactions on Solana devnet/mainnet via live protocol adapters.
# Portfolio overview with real on-chain data
makora status
# Swap via Jupiter aggregator (real quote + execution)
makora swap 0.1 SOL USDC
# Stake via Marinade Finance (real mSOL conversion)
makora stake 1.0
# Strategy evaluation with live portfolio analysis
makora strategy
# Run single OODA cycle
makora auto cycle
# Enable autonomous mode
makora auto on
# Shield SOL into privacy pool (ZK proof)
makora shield 1.0
# Natural language command
makora agent "swap half my SOL to USDC"/start - Welcome and command list
/status - Real-time portfolio
/swap 10 SOL USDC - Jupiter quote
/stake 5 - Marinade staking quote
/strategy - Strategy evaluation
/auto cycle - Run OODA cycle
/shield 1 - Privacy shield info
/health - Agent health check
Or natural language: "what should I do with my portfolio?"
Makora exposes a REST API so other agents can compose on top of it.
# Health check
GET /api/health
# Read any wallet's portfolio
GET /api/portfolio/:wallet
# Jupiter swap quote
GET /api/quote/swap?from=SOL&to=USDC&amount=10
# Marinade stake quote
GET /api/quote/stake?amount=5
# Strategy evaluation for any wallet
GET /api/strategy/evaluate/:wallet
# Risk assessment
GET /api/risk/check
# Generate stealth address (ZK privacy)
POST /api/privacy/stealth-address
# Agent OODA status
GET /api/agent/status
# Run single OODA cycle
POST /api/agent/cycle
# Natural language command
POST /api/agent/command { "command": "swap 10 SOL to USDC" }
# LLM-powered analysis (dashboard)
POST /api/llm/analyze { "provider": "anthropic", "apiKey": "...", ... }
POST /api/llm/stream (SSE streaming variant)
POST /api/llm/ping (API key validation)
# Polymarket intelligence
GET /api/polymarketHeadless Node.js process that runs the OODA loop 24/7 with LLM reasoning:
# Configure via env vars
LLM_PROVIDER=anthropic \
LLM_API_KEY=sk-ant-... \
LLM_MODEL=claude-sonnet-4-20250514 \
SOLANA_RPC_URL=https://api.devnet.solana.com \
WALLET_PATH=~/.config/solana/id.json \
CYCLE_INTERVAL_MS=60000 \
AGENT_MODE=advisory \
node apps/worker/dist/index.js
# Health check: GET http://localhost:8081/health
# Status: GET http://localhost:8081/statusDeployable to Railway (free tier) or run locally with pm2.
makora/
+-- packages/
| +-- types/ # Shared type definitions
| +-- data-feed/ # Portfolio reader, Jupiter prices, Polymarket feed
| +-- llm-provider/ # LLM provider layer (Anthropic/OpenAI/Qwen, raw fetch)
| +-- protocol-router/ # Multi-protocol routing + adapter registry
| +-- execution-engine/ # TX build -> simulate -> risk check -> send -> confirm -> retry
| +-- risk-manager/ # VETO power + circuit breaker + daily loss tracking
| +-- strategy-engine/ # Market analyzer + yield optimizer + rebalancer
| +-- agent-core/ # OODA loop + LLM orient + NL parser + decision log
| +-- session-manager/ # Stealth trading sessions (ephemeral wallet rotation)
| +-- privacy/ # Stealth addresses + shielded transfers + Merkle tree + ZK prover
| +-- adapters/
| +-- jupiter/ # DEX aggregator (real @jup-ag/api)
| +-- marinade/ # Liquid staking (real @marinade.finance/marinade-ts-sdk)
| +-- raydium/ # AMM / CLMM
| +-- kamino/ # Vault strategies
| +-- privacy/ # Shield / unshield via makora_privacy program
+-- apps/
| +-- cli/ # Terminal interface (7 commands, real execution)
| +-- dashboard/ # Next.js web UI with LLM reasoning + Polymarket + The Wheel
| +-- telegram/ # Telegram bot (grammy)
| +-- api/ # REST API (Express, 10 endpoints)
| +-- worker/ # Headless agent worker (24/7 OODA loop with LLM)
+-- programs/
| +-- makora_vault/ # Anchor -- portfolio vaults
| +-- makora_strategy/ # Anchor -- strategy + audit trail
| +-- makora_privacy/ # Anchor -- stealth + shielded pool + nullifiers
+-- circuits/
| +-- transfer.circom # Shielded transfer proof
| +-- merkle.circom # Merkle inclusion proof
| +-- poseidon.circom # Poseidon hash (ZK-friendly)
+-- tests/
+-- integration.test.ts # End-to-end integration tests
23 packages | 3 Solana programs | 3 ZK circuits | 5 apps | ~25,000 lines of code
| Layer | Technology |
|---|---|
| Blockchain | Solana (devnet + mainnet-beta) |
| Smart Contracts | Anchor 0.30.1 / Rust |
| ZK Proofs | Circom / Groth16 / snarkjs |
| LLM Intelligence | Anthropic Claude / OpenAI GPT / Qwen (BYOK, raw fetch) |
| Market Intelligence | Polymarket Gamma API (prediction markets) |
| DeFi Protocols | Jupiter v6, Marinade v5, Raydium, Kamino |
| TypeScript | pnpm workspaces + Turborepo + tsup |
| CLI | Commander.js + chalk + ora |
| Dashboard | Next.js 16 + React 19 + Tailwind CSS |
| Telegram | grammy |
| API | Express + CORS |
| Worker | Node.js (Railway / pm2) |
| Wallet | Solana Wallet Adapter |
| Tests | Vitest |
Generate one-time addresses for receiving payments. The sender creates a fresh address from the recipient's stealth meta-address; only the recipient can detect and spend from it.
Sender -> generateStealthAddress(recipientMeta)
-> derives one-time PublicKey + ephemeral key
-> sends SOL to one-time address
-> only recipient can scan and claim
Deposit SOL into a shielded pool using ZK proofs. Withdraw to any address without linking sender and receiver.
Shield: commitment = Poseidon(secret, amount)
Merkle tree insert -> on-chain pool deposit
Unshield: Generate Groth16 proof of commitment knowledge
Verify on-chain -> withdraw without linkage
Auto-mode trades are routed through ephemeral wallets that rotate periodically, making it impossible to link trades back to the main wallet.
| Program | Program ID | Size | Purpose |
|---|---|---|---|
makora_vault |
BTAd1ghiv4jKd4kREh14jCtHrVG6zDFNgLRNoF9pUgqw |
246KB | Portfolio vaults with deposit/withdraw/position tracking |
makora_strategy |
EH5sixTHAoLsdFox1bR3YUqgwf5VuX2BdXFew5wTE6dj |
295KB | Strategy config + on-chain audit trail (ring buffer, 8 entries) |
makora_privacy |
C1qXFsB6oJgZLQnXwRi9mwrm3QshKMU8kGGUZTAa9xcM |
298KB | Stealth registry + shielded pool + nullifier double-spend prevention |
The risk manager has absolute VETO power over every agent action -- even when the LLM recommends it.
| Control | Default |
|---|---|
| Max position size | 25% of portfolio |
| Max slippage | 1% (100 bps) |
| Max daily loss | 5% (circuit breaker) |
| Min SOL reserve | 0.05 SOL (always keep gas) |
| Max protocol exposure | 50% per protocol |
If any check fails, the transaction is blocked -- even in autonomous mode, even if the LLM says to do it.
This entire project was built autonomously by Claude (Anthropic) for the Solana Agent Hackathon.
8 development phases, each executed by AI:
- Foundation -- Monorepo, types, data feed, Jupiter adapter, vault program, CLI
- Core DeFi -- Marinade/Raydium/Kamino adapters, protocol router, execution engine, risk manager
- Agent Intelligence -- Strategy engine (3 strategies), OODA loop, NL parser, strategy program
- Privacy Layer -- ZK circuits (Circom), stealth addresses, shielded transfers, privacy program
- CLI + Dashboard -- 7 CLI commands, Next.js dashboard with The Wheel visualization
- Telegram + API -- Telegram bot, REST API (10 endpoints), agent-to-agent composability
- Integration -- End-to-end tests, real devnet execution
- LLM Intelligence -- LLM provider layer (BYOK), Polymarket integration, AI-powered OODA ORIENT phase, dashboard reasoning panel, backend worker
Every line of TypeScript, Rust, and Circom was written by Claude. No human-written code.
Slashy Fx -- Solo dev, Volta Team
MIT
Built for the Solana Agent Hackathon by Volta Team