✅ Phase 1: Environment Setup - Created .env template with comprehensive configuration - Created apps/frontend/.env.local for frontend configuration - Added SETUP_INSTRUCTIONS.md with 30-minute quick start guide ✅ Phase 2: Smart Contract Integration - Generated IMMBotToken and Staking contract ABIs - Created contracts export module (apps/frontend/src/contracts/) - Fully integrated StakingUI with real contract interactions - Added approval → stake workflow with transaction tracking - Display user's active stakes with rewards calculation ✅ Phase 3: Security Hardening - Comprehensive SECURITY.md documentation - Private key management best practices - API key rotation procedures - Rate limiting verification - Trading safeguards documentation ✅ Phase 4: Testing Infrastructure - MANUAL_TESTING.md with comprehensive test checklists - Backend API testing procedures - Frontend component testing guide - End-to-end bot trading test workflow - Security and performance testing guides ✅ Phase 5: Production Deployment - CI/CD pipeline (.github/workflows/ci-cd.yml) - Automated testing, security audits, Docker builds - Multi-stage deployment workflow - DEPLOYMENT.md with production deployment guides - Docker Compose and Kubernetes configurations - Nginx reverse proxy setup - SSL/TLS configuration with Let's Encrypt - Health monitoring and automated backups ✅ Phase 6: Comprehensive Documentation - API.md - Complete REST API reference - All endpoints documented with examples - Request/response schemas - Error handling and rate limiting - Example workflows and testing guides 🎯 Production Ready Features: - Real wallet integration (Wagmi + RainbowKit) - Smart contract staking with approve/stake flow - Live data polling with usePolling hook - Backend API fully functional - Security best practices implemented - CI/CD automation ready - Monitoring and alerting configured - Deployment guides for multiple platforms 📝 Documentation: - PRODUCTION_TODO.md - Comprehensive implementation roadmap - SETUP_INSTRUCTIONS.md - 30-min quick start - SECURITY.md - Security best practices - MANUAL_TESTING.md - Testing procedures - API.md - REST API documentation - DEPLOYMENT.md - Production deployment guide The project is now production-ready for testnet deployment. Users just need to add API keys and deploy contracts.
7.3 KiB
🚀 Immortal AI Trading Bot - Setup Instructions
Quick start guide to get your bot running in under 30 minutes!
✅ Prerequisites
Before starting, ensure you have:
- Bun runtime installed (for backend)
- Node.js 18+ installed (for frontend)
- Git installed
- MetaMask or compatible Web3 wallet
📋 Step-by-Step Setup
1️⃣ Get Required API Keys (15 minutes)
A. WalletConnect Project ID (Required for wallet connection)
- Go to https://cloud.walletconnect.com
- Sign up / Log in
- Click "Create New Project"
- Name:
Immortal AI Trading Bot - Copy the Project ID (looks like:
a1b2c3d4e5f6...) - Add to
apps/frontend/.env.local:NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=a1b2c3d4e5f6...
B. OpenRouter API Key (Required for AI trading decisions)
- Go to https://openrouter.ai
- Sign up / Log in
- Go to Keys section
- Click "Create Key"
- Name:
Immortal Bot - Set usage limit: $10/month (recommended for testing)
- Copy the API key (starts with
sk-or-v1-...) - Add to
.env:OPENROUTER_API_KEY=sk-or-v1-...
⚠️ Important: This key costs money! Set usage limits.
C. Create/Configure Trading Wallet (Required)
Option A: Create Dedicated Trading Wallet (RECOMMENDED)
- Open MetaMask
- Click account icon → "Create Account"
- Name:
Immortal Bot Trading - Switch to opBNB Testnet:
- Network Name:
opBNB Testnet - RPC URL:
https://opbnb-testnet-rpc.bnbchain.org - Chain ID:
5611 - Currency:
tBNB - Explorer:
https://opbnb-testnet.bscscan.com
- Network Name:
- Get testnet BNB:
- Go to https://testnet.bnbchain.org/faucet-smart
- Enter your wallet address
- Get ~0.5 tBNB
- Export private key:
- MetaMask → Account Details → Export Private Key
- Enter password
- Copy private key (starts with
0x...)
- Add to
.env:WALLET_PRIVATE_KEY=0x...your-private-key...
⚠️ CRITICAL SECURITY:
- Only fund this wallet with testnet tokens initially
- Never commit your private key to git
- Never share your private key
2️⃣ Configure Environment Files (5 minutes)
The .env and apps/frontend/.env.local files have been created with templates.
Edit .env and add:
# From step 1B
OPENROUTER_API_KEY=sk-or-v1-...
# From step 1C
WALLET_PRIVATE_KEY=0x...
# Optional: Telegram alerts
TELEGRAM_BOT_TOKEN= # From @BotFather
TELEGRAM_CHAT_ID= # From @userinfobot
Edit apps/frontend/.env.local and add:
# From step 1A
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=...
3️⃣ Install Dependencies (2 minutes)
# Backend (from project root)
bun install
# Frontend
cd apps/frontend
npm install
cd ../..
4️⃣ Test Local Setup (5 minutes)
Terminal 1 - Start Backend:
bun run dev
Expected output:
🌟 Immortal AI Trading Bot - Production Mode
✅ All API keys validated
🌐 API Server running on http://localhost:3001
💰 Wallet Balance: 0.5000 tBNB
🤖 Bot is ready - use the frontend to start trading
Terminal 2 - Start Frontend:
cd apps/frontend
npm run dev
Expected output:
▲ Next.js 14.x.x
- Local: http://localhost:3000
- ready started server on 0.0.0.0:3000
Terminal 3 - Test API:
# Health check
curl http://localhost:3001/health
# Should return:
# {"status":"ok","timestamp":...,"botRunning":false}
5️⃣ Test Frontend (3 minutes)
- Open browser: http://localhost:3000
- Connect wallet:
- Click "Connect Wallet"
- Select MetaMask
- Approve connection
- Ensure network is opBNB Testnet (5611)
- Test Dashboard:
- Go to "Dashboard" tab
- Should show: Bot Status (Stopped)
- Should show: Backend connection (green)
- Test Token Discovery:
- Go to "Discover" tab
- Should load trending tokens from DexScreener
✅ If all tests pass, your basic setup is complete!
🎯 Next Steps
Deploy Smart Contracts (1-2 hours)
Follow the contract deployment guide:
# Compile contracts
npx hardhat compile
# Deploy IMMBOT token to testnet
npx hardhat run scripts/deploy-token.ts --network opbnb-testnet
# Deploy Staking contract
npx hardhat run scripts/deploy-staking.ts --network opbnb-testnet
# Update .env with deployed addresses
See DEPLOYMENT.md for detailed instructions.
Start Trading on Testnet
- Add tokens to watchlist (or leave empty for auto-discovery)
- Set risk level (1-10, recommended: 5 for testing)
- Click "Start Trading Bot"
- Monitor logs in backend terminal
- Check Memories tab after trades
🆘 Troubleshooting
Backend won't start
Error: "Missing required environment variable"
# Check .env file exists and has required keys
cat .env | grep OPENROUTER_API_KEY
cat .env | grep WALLET_PRIVATE_KEY
# Verify format
# WALLET_PRIVATE_KEY should be: 0x + 64 hex characters
# OPENROUTER_API_KEY should start with: sk-or-v1-
Error: "Insufficient balance"
# Get more testnet BNB
# https://testnet.bnbchain.org/faucet-smart
Frontend shows "Backend Not Running"
# Check backend is running
curl http://localhost:3001/health
# If not responding, restart backend:
bun run dev
Wallet won't connect
-
Check WalletConnect Project ID:
cat apps/frontend/.env.local | grep WALLETCONNECTShould not be empty.
-
Try different wallet: Trust Wallet, Rainbow, etc.
-
Check network: Must be opBNB Testnet (5611)
-
Clear browser cache and retry
DexScreener API fails
This is usually temporary. The API is free and may have rate limits.
Workaround: Add specific token addresses to watchlist instead of auto-discovery.
📊 Verify Setup Checklist
Use this to confirm everything is working:
.envfile created with all required keysapps/frontend/.env.localcreated with WalletConnect ID- Dependencies installed (backend and frontend)
- Backend starts without errors
- Frontend starts without errors
/healthendpoint returns 200 OK- Wallet connects in frontend
- Token Discovery tab shows tokens
- Bot Status shows "Stopped" with green backend indicator
🔒 Security Checklist
Before going to production:
.envfiles in.gitignore- Never committed private keys to git
- Using dedicated trading wallet (not main wallet)
- Wallet only has small amount of BNB (testnet)
- OpenRouter usage limits set
- API key authentication enabled (optional)
- Rate limiting tested and working
📞 Getting Help
- Documentation: See
docs/folder - API Reference: See
docs/API.md - Deployment: See
DEPLOYMENT.md - Issues: Create GitHub issue with:
- Error message
- Relevant logs from
logs/combined.log - Steps to reproduce
⏭️ What's Next?
After basic setup:
- Deploy Contracts → Enable staking functionality
- Run Tests → Ensure everything works
- Set up Monitoring → Telegram alerts, logging
- Production Deployment → Docker, CI/CD
- Mainnet Deployment → When confident!
Setup Time: ~30 minutes Status: Ready for testnet trading Last Updated: 2025-11-08