Major Documentation Update:
Rewrote QUICKSTART.md to reflect the new production architecture where
the bot is controlled via a frontend dashboard instead of CLI-only.
Key Changes:
1. Updated Architecture Description:
- Added "Frontend Dashboard" as first feature
- Noted "Frontend-controlled backend with real-time polling (NO MOCKS)"
- Emphasized web interface control
2. Installation Section:
- Added frontend dependencies installation (apps/frontend)
- Two .env files setup (backend + frontend)
- Uses bun instead of npm
3. Configuration Section:
- Split into Backend (.env) and Frontend (.env.local)
- Updated env var names (RPC_URL_TESTNET vs BNB_RPC)
- Added CHAIN_ID and API_PORT
- Added WalletConnect configuration for frontend
4. Running Section:
- Two-terminal setup (Backend + Frontend)
- Terminal 1: bun run dev (backend)
- Terminal 2: cd apps/frontend && bun run dev (frontend)
- Clear output examples for each terminal
5. Start Trading Flow:
- Updated to web dashboard workflow:
1. Open http://localhost:3000
2. Connect wallet
3. Configure via UI
4. Click Start Trading Bot button
- No more CLI-only trading
6. What You'll See:
- Backend console output (validation, config summary, API ready)
- Frontend dashboard features:
- Dashboard Tab: Bot controls
- Trading Stats: Real-time metrics (30s refresh)
- Memories Tab: Greenfield trades (60s refresh)
- Discover Tab: DexScreener trending (120s refresh)
- Replaced old CLI-only output
Benefits:
- Matches actual production implementation
- Clear two-terminal development workflow
- Frontend dashboard as primary interface
- Real-time data refresh intervals documented
- Accurate startup expectations
This QUICKSTART now aligns with README.md and the actual codebase!
9.5 KiB
๐ Quick Start Guide
Get the Immortal AI Trading Bot running in 5 minutes!
โ What This Bot Does
- Frontend Dashboard - Control bot from web interface (Next.js)
- Fetch Market Data - Real-time from DexScreener for BNB Chain tokens
- AI Analysis - Uses GPT-4o-mini via OpenRouter for intelligent decisions
- Execute Trades - Automated trading on PancakeSwap when AI is confident
- Immortal Memory - Stores all trades on BNB Greenfield for permanent learning
- Telegram Alerts - Get notified of all trades and events
Based on: https://github.com/hkirat/ai-trading-agent (adapted for BNB Chain)
Architecture: Frontend-controlled backend with real-time polling (NO MOCKS)
๐ Prerequisites (5 minutes)
1. Get OpenRouter API Key (FREE)
# 1. Visit https://openrouter.ai/signup
# 2. Sign up with email
# 3. Go to "Keys" tab
# 4. Create new key
# 5. Copy the key (starts with sk-or-...)
2. Get BNB Testnet Funds (FREE)
# 1. Install MetaMask (if not installed)
# 2. Add BNB Testnet:
# - Network: BNB Smart Chain Testnet
# - RPC: https://bsc-testnet.bnbchain.org
# - Chain ID: 97
# - Symbol: BNB
# - Explorer: https://testnet.bscscan.com
# 3. Get test BNB:
# Visit: https://testnet.bnbchain.org/faucet-smart
# Paste your wallet address
# Claim 0.5 test BNB (repeatable daily)
# 4. Export private key:
# MetaMask โ Account Details โ Export Private Key
# Copy the key (keep it SECRET!)
3. Get Telegram Bot Token (OPTIONAL)
# 1. Open Telegram
# 2. Search: @BotFather
# 3. Send: /newbot
# 4. Follow prompts to name your bot
# 5. Copy token (e.g., 1234567890:ABC...)
# 6. Get your chat ID:
# - Send a message to your bot
# - Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
# - Find "chat":{"id": 123456789}
# - Copy the ID
โ๏ธ Installation (2 minutes)
# 1. Clone repository
git clone https://github.com/caelum0x/immortal-bnb.git
cd immortal-bnb
# 2. Install backend dependencies
bun install
# 3. Install frontend dependencies
cd apps/frontend
bun install
cd ../..
# 4. Create .env files
cp .env.example .env
cp apps/frontend/.env.example apps/frontend/.env.local
๐ง Configuration (2 minutes)
Backend Configuration (.env)
Edit .env file in the root directory:
# ===== CRITICAL - REQUIRED =====
OPENROUTER_API_KEY=sk-or-v1-your-actual-key-here
WALLET_PRIVATE_KEY=0xYOUR_ACTUAL_PRIVATE_KEY_HERE
# ===== NETWORK =====
RPC_URL_TESTNET=https://opbnb-testnet-rpc.bnbchain.org
NETWORK=testnet
CHAIN_ID=5611
# ===== API SERVER =====
API_PORT=3001
# ===== OPTIONAL: Telegram Alerts =====
TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_CHAT_ID=your-chat-id-here
# ===== TRADING SETTINGS (SAFE DEFAULTS) =====
MAX_TRADE_AMOUNT_BNB=1.0
STOP_LOSS_PERCENTAGE=10
MAX_SLIPPAGE_PERCENTAGE=2
BOT_LOOP_INTERVAL_MS=300000
Frontend Configuration (apps/frontend/.env.local)
Edit .env.local in the frontend directory:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3001
# Network
NEXT_PUBLIC_USE_MAINNET=false
# WalletConnect (get from https://cloud.walletconnect.com/)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here
๐ฏ Running the Bot (1 minute)
Development Mode (Recommended)
Terminal 1 - Backend:
# Start backend server + bot
bun run dev
# You'll see:
# ๐ Immortal AI Trading Bot - Production Mode
# โ
Environment validation passed
# ๐ค Bot is ready - use the frontend to start trading
# ๐ API Server: http://localhost:3001
Terminal 2 - Frontend:
# Start frontend dashboard
cd apps/frontend
bun run dev
# You'll see:
# โฒ Next.js 14.x.x
# - Local: http://localhost:3000
# - ready in Xms
Production Mode
# Build frontend
cd apps/frontend
bun run build
cd ../..
# Run backend
bun run start
Start Trading
- Open http://localhost:3000 in your browser
- Click "Connect Wallet" (top right)
- Configure in Dashboard tab:
- Watchlist: Add token addresses OR leave empty for auto-discovery
- Risk Level: 1-10 (start with 3-5)
- Click "๐ Start Trading Bot"
- Watch live trades in:
- Dashboard: Bot status and controls
- Memories: All trade history from Greenfield
- Discover: Trending tokens from DexScreener
- Stats: Win rate, P/L tracking
๐ What You'll See
Backend Console (Terminal 1)
๐ Immortal AI Trading Bot - Production Mode
โ
Environment validation passed
๐ Current Configuration:
Network: TESTNET
Chain ID: 5611
RPC: https://opbnb-testnet-rpc.bnbchain.org...
Wallet: 0x1234567890...
๐ฐ Trading Parameters:
Max Trade: 1.0 BNB
Stop Loss: 10%
Slippage: 2%
Interval: 300s
๐ Integrations:
OpenRouter: โ
Configured
Telegram: โ
Configured
Greenfield: โช Optional
API server listening on port 3001
๐ค Bot is ready - use the frontend to start trading
Frontend Dashboard (Browser)
Dashboard Tab:
- โ Bot status (Running/Stopped)
- โ๏ธ Token watchlist configuration
- ๐๏ธ Risk level slider (1-10)
- ๐ Start/Stop button
- ๐ Current configuration display
Trading Stats:
- ๐ Total trades: 12
- โ Win rate: 67%
- ๐ต Total P/L: +0.15 BNB
- ๐ Real-time updates every 30s
Memories Tab:
- ๐ All trades from Greenfield
- ๐ Filter by profit/loss/pending
- ๐ง AI reasoning for each trade
- ๐ Market conditions snapshot
- ๐ Auto-refresh every minute
Discover Tab:
- ๐ฅ Trending tokens from DexScreener
- ๐ฐ Price, volume, liquidity data
- ๐ Copy contract addresses
- ๐ Links to DexScreener & PancakeSwap
- ๐ Auto-refresh every 2 minutes
๐ก Understanding AI Decisions
The AI will ONLY trade when:
-
High Confidence (>70%) based on:
- Strong volume and liquidity
- Positive buy/sell pressure
- Good price momentum
- Similar patterns to successful past trades
-
Safety Checks Pass:
- Liquidity > $10,000
- Amount within max limit
- Sufficient wallet balance
- Not on cooldown
-
Risk is Acceptable:
- Stop-loss set
- Position sizing appropriate
- Slippage within limits
๐ Monitoring
Check Logs
# View all logs
tail -f logs/combined.log
# View only errors
tail -f logs/error.log
# Search for trades
grep "Trade executed" logs/combined.log
Check Telegram
All important events sent to your Telegram:
- AI decisions
- Trade executions
- Profit/loss results
- Error notifications
Check Blockchain
Every trade creates a transaction:
# Testnet: https://testnet.bscscan.com
# Search your wallet address
# View all transactions
๐ Stopping the Bot
# Press Ctrl+C
# You'll see:
๐ Shutting down gracefully...
Bot shutting down
๐ Advanced Usage
Add Token Watchlist
Edit .env:
# Instead of trending tokens, monitor specific tokens
DEFAULT_WATCHLIST=0xToken1,0xToken2,0xToken3
Adjust Risk Settings
Edit .env:
# More conservative (recommended for beginners)
MAX_TRADE_AMOUNT_BNB=0.01
STOP_LOSS_PERCENTAGE=3
# More aggressive (higher risk/reward)
MAX_TRADE_AMOUNT_BNB=0.2
STOP_LOSS_PERCENTAGE=10
Change Bot Frequency
Edit .env:
# Check every 1 minute (more active)
BOT_LOOP_INTERVAL_MS=60000
# Check every 30 minutes (less active)
BOT_LOOP_INTERVAL_MS=1800000
โ Troubleshooting
"OPENROUTER_API_KEY not set"
# Make sure .env exists and has the key
cat .env | grep OPENROUTER
# Should show: OPENROUTER_API_KEY=sk-or-...
"Insufficient funds"
# Get more testnet BNB
# Visit: https://testnet.bnbchain.org/faucet-smart
"Could not fetch data for token"
# Token might not be on DexScreener yet
# Try with a different token address
# Or wait and retry
"Trade failed"
Common causes:
- Not enough BNB for gas
- Token has transfer restrictions
- Liquidity too low
- Slippage too high
๐จ Important Warnings
-
Start with Testnet
- Never use mainnet until thoroughly tested
- Testnet BNB is free and safe
-
Use Small Amounts
- Keep MAX_TRADE_AMOUNT_BNB low
- $5-10 max for testing
-
Monitor Actively
- Check logs regularly
- Don't leave unattended for long periods
-
Private Keys
- NEVER share your private key
- NEVER commit .env to git
- Use separate wallet for bot
-
This is Experimental
- AI can make mistakes
- Past performance โ future results
- Only risk what you can afford to lose
๐ Next Steps
Once comfortable with testnet:
-
Deploy Contracts
- See
INTEGRATION_GUIDE.md - Deploy $IMMBOT token to testnet
- Set up staking
- See
-
Switch to Mainnet (when ready)
NETWORK=mainnet BNB_RPC=https://bsc-dataseed.bnbchain.org -
Add More Features
- Customize AI prompt in
src/prompt.ts - Add more trading strategies
- Build dashboard frontend
- Customize AI prompt in
๐ค Get Help
- Issues: https://github.com/caelum0x/immortal-bnb/issues
- Docs: See
README.md,ARCHITECTURE.md,INTEGRATION_GUIDE.md - Base Repo: https://github.com/hkirat/ai-trading-agent
โจ What Makes This Special
"An AI that never forgets"
Every trade is stored on BNB Greenfield (decentralized storage), creating a permanent learning history. The AI learns from every trade and gets smarter over time. Unlike other bots that reset on restart, this bot has true immortal memory.
Happy Trading! ๐
Remember: Start small, trade safe, and let the AI learn!