RHUN is an advanced AI-powered DeFi automation and analysis platform built on Solana. It combines AI agents, real-time market data, technical analysis, and automated trading capabilities to provide comprehensive cryptocurrency and DeFi management tools.
RHUN enables users to:
- Create AI Agents with specialized knowledge and autonomous trading capabilities
- Analyze Markets with real-time data from multiple sources
- Execute Trades through delegated wallet automation
- Monitor Portfolios across Solana tokens and DeFi protocols
- Research Cryptocurrencies with integrated news, social sentiment, and technical analysis
- Custom AI agents with configurable personalities and expertise
- Knowledge base integration for specialized domain knowledge
- Autonomous decision-making with user-defined parameters
- Multi-model support (OpenAI GPT-4, Anthropic Claude)
- Real-time portfolio tracking across Solana wallets
- Token holdings analysis with USD valuations
- Portfolio performance metrics and analytics
- Multi-wallet support for users and agents
- Delegated wallet integration using Privy
- Multiple trading strategies (DCA, Momentum, Limit Orders, Rebalancing)
- Scheduled execution with AWS Lambda and EventBridge
- Risk management and position sizing controls
- Technical analysis with 15+ indicators
- Real-time price data and market sentiment
- Social media sentiment analysis (Twitter integration)
- Economic data integration (FRED API)
The core functionality revolves around the chat system that provides AI-powered interactions:
POST /api/chat
- Primary AI chat interface with tool integration
- Supports streaming responses for real-time interaction
- Tool execution with result caching for large datasets
- Context-aware responses using vector embeddings
GET /api/chat/[chatId]
- Retrieve chat history with message threading
- Support for both user and template chats
- Automatic file attachment handling with signed URLs
POST /api/chat/[chatId]
- Update chat metadata and last message
- Template chat support for agent demonstrations
GET /api/chat/recent
- Fetch recent chat history for users
- Paginated results with metadata
POST /api/chat/messages
- Store chat messages with tool invocation results
- File attachment support with S3 integration
- Large result handling with automatic S3 storage
GET /api/chat/messages
- Retrieve presigned URLs for stored data access
- Secure temporary access to large datasets
POST /api/chat/events
- Server-sent events for real-time analysis
- Streaming responses for long-running operations
POST /api/chat/presigned
- Generate presigned URLs for file uploads
- Secure file handling with size and type restrictions
RHUN provides 50+ specialized tools for cryptocurrency and DeFi analysis:
getUserPortfolioValue- Real-time portfolio valuationgetAgentPortfolioValue- Agent wallet analysisgetUserTokenHoldings- Detailed token inventorygetAgentTokenHoldings- Agent token positions
getMarketMovers- Top gainers/losers analysisgetTotalCryptoMarketCap- Global market metricsgetFearAndGreedIndex- Market sentiment indicatorgetSolanaTransactionVolume- Network activity metricsgetDerivativesExchanges- Futures market data
getTokenInfo- Comprehensive token analysissearchTokens- Multi-source token discoverygetTopHolders- Whale and distribution analysisgetRecentDexScreenerTokens- New token discoverygetTrendingTokens- Momentum identification
getTechnicalAnalysis- 15+ technical indicators- SMA/EMA moving averages
- RSI, MACD, Stochastic RSI
- Bollinger Bands, Ichimoku Cloud
- Support/Resistance levels
- Volume analysis and momentum
swap- Token swapping via JupitergetTradingViewChart- Interactive price chartsexecuteSwap- Direct trade execution
getCryptoNews- Curated cryptocurrency newsgetOfficialTweets- Project social media analysissearchTweets- Social sentiment tracking (when available)
getFredSeries- Federal Reserve economic datafredSearch- Economic indicator discovery- Access to GDP, inflation, employment, and monetary data
getAccountDetails- Wallet activity analysisgetAccountActivities- Transaction historytrackWallet- Ongoing wallet monitoring
webResearch- AI-powered web researchnewsAnalysis- Market impact analysisstockAnalysis- Traditional market analysis
- Next.js 14 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- React with modern hooks and context
- Vercel Edge Functions for scalable API endpoints
- AWS Lambda for background processing
- DynamoDB for data persistence
- S3 for file storage and large datasets
- Solana Web3.js for blockchain interactions
- Privy for wallet management and authentication
- Jupiter for token swapping
- Raydium SDK for AMM interactions
- OpenAI GPT-4 for conversational AI
- Anthropic Claude for advanced reasoning
- Pinecone for vector search and embeddings
- Custom technical analysis engine
- Helius - Solana RPC and historical data
- CoinGecko - Cryptocurrency market data
- Solscan - Solana account and transaction data
- DexScreener - DEX trading data
- FRED - Federal Reserve economic data
- Twitter API - Social sentiment analysis
Copy .env.example to .env and configure the following:
# Core Application
NEXT_PUBLIC_URL=your-domain.com
OPENAI_API_KEY=your-openai-key
ANTHROPIC_API_KEY=your-anthropic-key
# Blockchain & Wallets
HELIUS_API_KEY=your-helius-key
NEXT_PUBLIC_PRIVY_APP_ID=your-privy-app-id
PRIVY_APP_SECRET=your-privy-secret
# AWS Infrastructure
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_REGION=us-west-2
# External APIs
COINGECKO_API_KEY=your-coingecko-key
SOLSCAN_API_KEY=your-solscan-key
FRED_API_KEY=your-fred-keySee .env.example for the complete list of required environment variables.
-
Clone and install dependencies:
git clone <repository-url> cd rhun-app pnpm install
-
Configure environment:
cp .env.example .env # Edit .env with your API keys and configuration -
Start development server:
pnpm dev
-
Access the application:
- Navigate to
http://localhost:3000 - Connect your Solana wallet
- Create or interact with AI agents
- Navigate to
rhun-app/
├── app/ # Next.js App Router
│ ├── (auth)/ # Protected routes
│ │ ├── agents/ # Agent management
│ │ ├── portfolio/ # Portfolio dashboard
│ │ └── marketplace/ # Agent marketplace
│ ├── api/ # API endpoints
│ │ ├── chat/ # Chat system APIs
│ │ ├── trading/ # Trading endpoints
│ │ └── tools/ # Tool-specific APIs
│ └── components/ # UI components
├── components/ # Shared components
│ ├── tools/ # Tool UI components
│ └── ui/ # Base UI components
├── utils/ # Utility functions
│ ├── agent-tools.ts # AI tool implementations
│ ├── technical-analysis.ts # TA calculations
│ └── server-wallet.ts # Wallet operations
├── types/ # TypeScript definitions
└── contexts/ # React contexts
Required AWS services:
-
DynamoDB Tables:
Agents- Agent configurationsChatMessages- Chat historyTokenHoldersActivity- Blockchain monitoringTradingStrategies- Automated trading configs
-
Lambda Functions:
- Trading execution engine
- Wallet monitoring
- Background data processing
-
EventBridge Rules:
- Scheduled trading execution
- Market data updates
// Agents can be configured with:
// - Custom personalities and knowledge
// - Specific trading strategies
// - Risk management parameters
// - Automated execution permissions// Examples of natural language queries:
// "Show me technical analysis for Solana"
// "What are the top gainers today?"
// "Swap 10 SOL for USDC"
// "Track this wallet: [address]"
// "What's the latest GDP data?"// Set up automated strategies:
// - Dollar Cost Averaging (DCA)
// - Momentum-based trading
// - Limit orders
// - Portfolio rebalancing- Wallet Security: Privy-managed delegated wallets with user consent
- Data Encryption: All sensitive data encrypted at rest and in transit
- Rate Limiting: API protection with Redis-based rate limiting
- Access Control: JWT-based authentication with role management
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a pull request
This project is licensed under the MIT License - see LICENSE for details.
For support:
- Check the documentation
- Search existing issues
- Create a new issue with detailed information
- Contact: support@rhun.io
RHUN - Autonomous Intelligence for Decentralized Finance