Aither-Somnia is the first open-source multi-agent AI copilot designed specifically for DeFi operations on Somnia blockchain. It orchestrates specialized AI agents to execute complex financial strategies through natural language, making DeFi accessible to everyone while maintaining the security and transparency that crypto users demand.
- π€ Multi-Agent Intelligence: Trade, Stake, Portfolio, Research, and Analytics agents working together
- π¬ Natural Language Interface: "Stake 100 STT with the best validator" β Automatic execution
- π Security First: On-chain allowlists, slippage protection, 2FA confirmation for sensitive operations
- β‘ Somnia Optimized: Built for Somnia's high-performance blockchain infrastructure
- π οΈ Developer Friendly: Comprehensive SDK for building custom agents
- π Full Transparency: All operations on-chain with detailed execution logs
- Trade Agent: Executes swaps with optimal routing and slippage protection
- Stake Agent: Manages validator delegation and rewards claiming
- Portfolio Agent: Real-time balance tracking and PnL analysis
- Research Agent: Market data and news via Venice API integration
- Analytics Agent: Transaction decoding and performance metrics
- Natural language to on-chain execution
- Transaction preview with risk assessment
- Dry-run simulation before execution
- Batched operations for gas efficiency
- Automatic slippage protection
- Multi-step operation orchestration
- On-chain allowlists for contracts
- Per-intent spending limits
- 2-factor confirmation for sensitive actions
- Mandatory transaction simulation
- Approval minimization and auto-revoke
- Framework: Next.js 15, React 18, TypeScript
- UI: Tailwind CSS, Shadcn UI, Framer Motion
- Wallet: MetaMask, WalletConnect, Keplr
- AgentRegistry: On-chain agent registration and capabilities
- AgentOrchestrator: Role-based access control and operation batching
- ExecutionProxy: Secure multicall execution with event emission
- SwapAdapter: DEX integration and routing
- StakingAdapter: Validator delegation and rewards management
- PortfolioView: Read-only balance and PnL helpers
- Runtime: Node.js with TypeScript
- AI: OpenRouter (GPT-4, Claude) for intent parsing
- Venice API: Research and analytics integration
- Database: PostgreSQL via Supabase
- Blockchain: Somnia Testnet (Shannon) integration
- Node.js 18+ and npm/yarn/pnpm
- MetaMask or compatible Web3 wallet
- Somnia Testnet STT tokens (Get from faucet)
git clone https://github.com/aither-somnia/aither-somnia
cd aither-somnianpm install
# or
yarn install
# or
pnpm installCopy the .env.example file to .env.local and fill in the required values:
cp .env.example .env.localRequired environment variables:
NEXT_PUBLIC_SUPABASE_URL: Your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY: Your Supabase anonymous keySUPABASE_JWT_SECRET: Secret key for JWT token generationOPENROUTER_API_KEY: API key for OpenRouterOPENROUTER_BASE_URL: Base URL for OpenRouter APIMODEL: AI model to useVENICE_API: Venice API key for research agentSOMNIA_RPC_URL: Somnia Testnet RPC endpointSOMNIA_CHAIN_ID: Somnia Testnet chain ID (Shannon)SOMNIA_EXPLORER_URL: Somnia block explorer URLSTT_SYMBOL: Somnia Test Token symbol (STT)
You need to set up the following tables in your Supabase PostgreSQL database:
CREATE TABLE users (
id UUID PRIMARY KEY,
wallet_address TEXT UNIQUE NOT NULL,
nonce UUID
);CREATE TABLE chats (
id UUID PRIMARY KEY,
ai_id UUID,
user_id UUID REFERENCES users(id),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
title TEXT
);CREATE TABLE messages (
id UUID PRIMARY KEY,
chat_id UUID REFERENCES chats(id),
sender_id UUID REFERENCES users(id),
message JSONB NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 with your browser to see the application.
- Router LLM parses intent and identifies staking requirement
- Portfolio Agent checks current balance and positions
- Analytics Agent evaluates validator performance metrics
- Stake Agent finds optimal validator (highest APR Γ uptime / commission)
- Preview shows: Validator choice, expected APR, fees, transaction cost
- User confirms β Transaction executes β Explorer link provided
- Trade Agent analyzes available DEX routes
- Calculates optimal path with minimal price impact
- Preview shows: Expected output, price impact, gas costs
- Dry-run simulation validates the swap
- User confirms β Swap executes β Success notification with details
- Portfolio Agent aggregates all token balances and staking positions
- Analytics Agent calculates PnL, yield earned, and gas spent
- Generates interactive charts and performance metrics
- Displays allocation breakdown and risk assessment
- Provides recommendations for optimization
- Stake Agent scans all active staking positions
- Calculates pending rewards across validators
- Batches reward claims for gas efficiency
- Preview shows: Total rewards, gas cost, net gain
- User confirms β Batch execution β Rewards transferred
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.
/app: Main application code/api: API routes for backend functionality/components: React components/providers: Context providers/services: Service functions for API calls
/lib: Utility libraries/public: Static assets/ai: AI-related functionality/wallet: Wallet integration code
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Note: These contracts are ready for deployment. Run the deployment script to get actual addresses.
| Contract | Address | Purpose |
|---|---|---|
| AgentRegistry | TBD |
On-chain agent registration and capabilities |
| AgentOrchestrator | TBD |
Multi-agent coordination and execution |
| ExecutionProxy | TBD |
Secure multicall execution with allowlists |
| SwapAdapter | TBD |
DEX integration and token swapping |
| StakingAdapter | TBD |
Validator staking and rewards |
| PortfolioView | TBD |
Read-only portfolio analytics |
-
Setup Environment
cp .env.example .env.local # Add your private key and Somnia RPC URL -
Install Dependencies
cd contracts npm install -
Deploy to Somnia Testnet
npm run deploy:somnia
-
Update Environment Variables
- Copy the deployed addresses from the deployment output
- Update your
.env.localwith the new contract addresses
-
Verify Contracts (Optional)
npm run verify
# Run unit tests
npm test
# Run integration tests
npm run test:integration
# Deploy to Somnia Testnet
npm run deploy:somnia