diff --git a/DEPLOY_NOW_FOR_24H_TARGET.md b/DEPLOY_NOW_FOR_24H_TARGET.md new file mode 100644 index 0000000..8f62dc6 --- /dev/null +++ b/DEPLOY_NOW_FOR_24H_TARGET.md @@ -0,0 +1,360 @@ +# 🚀 Deploy NOW for 24-Hour Execution Target +**Status:** CRITICAL BUG FIXED - READY TO DEPLOY +**Time:** October 29, 2025 04:20 + +--- + +## ✅ What Was Fixed + +### CRITICAL BUG: Empty Token Graph +The multi-hop arbitrage scanner had **ZERO pools** in its token graph! + +**Before (BROKEN):** +```go +func updateTokenGraph() error { + mhs.tokenGraph.adjacencyList = make(...) // Clear graph + // Add some example pools... + // ← THIS WAS EMPTY - NO POOLS ADDED + return nil +} +``` + +**After (FIXED):** +- ✅ Added 8 high-liquidity Arbitrum pools +- ✅ WETH/USDC, ARB/USDC, USDC/USDC.e, etc. +- ✅ Real verified addresses with high volume + +### AGGRESSIVE SETTINGS +Lowered ALL thresholds by 5-10x: +- Min profit: $0.20 → $0.02 (10x lower) +- Min ROI: 0.05% → 0.01% (5x lower) +- Gas safety: 5x → 1.5x (3.3x lower) + +--- + +## 🎯 DEPLOYMENT STEPS + +### 1. Stop Any Running Bot +```bash +pkill mev-bot +sleep 2 +ps aux | grep mev-bot # Verify stopped +``` + +### 2. Deploy with Production Config +```bash +cd /home/administrator/projects/mev-beta + +# Start bot +GO_ENV=production \ +PROVIDER_CONFIG_PATH=$PWD/config/providers_runtime.yaml \ +nohup ./bin/mev-bot start > /dev/null 2>&1 & + +# Get PID +echo $! > /tmp/mev-bot.pid +``` + +### 3. Verify Startup (CRITICAL) +```bash +# Should see within 30 seconds: +tail -f logs/mev_bot.log | grep -i "token graph\|8 high-liquidity\|MEV bot\|arbitrage" + +# Look for: +# ✅ "Token graph updated with 8 high-liquidity pools" +# ✅ "Arbitrage service started" +# ✅ "MEV coordinator operational" +``` + +### 4. Monitor for Non-Zero Profit +```bash +# Watch for opportunities with ACTUAL profit +tail -f logs/mev_bot.log | grep "estimatedProfitETH" | grep -v "0.000000" + +# Should see within 1-2 hours: +# estimatedProfitETH:0.00002 (or higher) +``` + +--- + +## 📊 MONITORING COMMANDS + +### Real-Time Monitoring +```bash +# Terminal 1: Watch opportunities +tail -f logs/mev_bot.log | grep "OPPORTUNITY" + +# Terminal 2: Count profitable ones +watch -n 30 'tail -2000 logs/mev_bot.log | grep "estimatedProfitETH" | grep -v "0.000000" | wc -l' + +# Terminal 3: Watch for executions +tail -f logs/mev_bot.log | grep -i "executing\|submitted\|success" +``` + +### Periodic Checks (Every Hour) +```bash +# Count opportunities detected +tail -3000 logs/mev_bot.log | grep "ARBITRAGE OPPORTUNITY DETECTED" | wc -l + +# Count with non-zero profit +tail -3000 logs/mev_bot.log | grep "estimatedProfitETH" | grep -v "0.000000" | wc -l + +# Count execution attempts +tail -3000 logs/mev_bot.log | grep -i "executing arbitrage" | wc -l + +# Check service stats +tail -100 logs/mev_bot.log | grep "Arbitrage Service Stats" +``` + +--- + +## ✅ SUCCESS INDICATORS + +### Hour 1-2: Expect +- ✅ Bot running without errors +- ✅ Blocks being processed continuously +- ✅ DEX transactions detected (10-50 per hour) +- ✅ Opportunities showing up in logs (even if all rejected) + +### Hour 2-6: Hope For +- ✅ At least 1 opportunity with `estimatedProfitETH` > 0.00001 +- ✅ Net profit > $0 after gas on at least 1 opportunity +- ✅ First execution attempt (may fail - that's OK) + +### Hour 6-24: TARGET +- ✅ **GOAL**: 1 successful profitable execution +- ✅ 5-20 opportunities with profit > $0.02 +- ✅ 3-10 execution attempts +- ✅ Net P&L >= $0 (break-even or profit) + +--- + +## 🆘 TROUBLESHOOTING + +### Issue: Still seeing estimatedProfitETH: 0.000000 + +**Check 1: Token graph loaded?** +```bash +grep "Token graph updated" logs/mev_bot.log +grep "8 high-liquidity pools" logs/mev_bot.log +``` + +If **NOT found**, the fix didn't apply: +```bash +# Verify code was compiled correctly +grep -A20 "func.*updateTokenGraph" pkg/arbitrage/multihop.go | head -25 + +# Should see pool definitions (WETH, USDC, etc.) +# If you see "// Add some example pools..." with nothing after, code wasn't updated! + +# Rebuild +make build + +# Restart +pkill mev-bot +GO_ENV=production ./bin/mev-bot start +``` + +**Check 2: Multi-hop scanner being called?** +```bash +tail -1000 logs/mev_bot.log | grep -i "multi.*hop\|scan.*arbitrage" +``` + +If **NOT found**, scanner isn't running - this is a bigger problem. + +### Issue: Opportunities found but none > $0.02 profit + +**This is NORMAL for first few hours.** Market is efficient. + +**Solutions:** +1. **Lower threshold further** (RISKY): + ```yaml + # In config/arbitrum_production.yaml + min_profit_wei: 5000000000000 # $0.01 instead of $0.02 + ``` + +2. **Wait longer** - May take 6-12 hours to see first real opportunity + +3. **Check if competing bots are faster** - Most opportunities taken in milliseconds + +### Issue: Bot keeps crashing or stopping + +**Check logs for errors:** +```bash +grep -i "error\|fatal\|panic" logs/mev_bot.log | tail -20 +``` + +**Common issues:** +- RPC rate limiting → Already fixed +- Out of memory → Increase system RAM +- Invalid contract addresses → Verify contracts deployed + +--- + +## 📈 EXPECTED TIMELINE + +### Hour 0-2: Detection Phase +- Bot starts successfully +- Processes blocks continuously +- Detects 10-50 DEX transactions/hour +- ALL opportunities show $0 profit (normal initially) +- **No execution attempts** (normal) + +### Hour 2-6: Discovery Phase +- First opportunities with profit > $0 appear +- Still mostly unprofitable opportunities +- **0-2 execution attempts** (may all fail) +- Learning phase - bot adapting to market + +### Hour 6-12: Optimization Phase +- More frequent profitable opportunities +- **3-5 execution attempts** +- First successful execution (TARGET) +- Profit: $0.02-$0.10 per trade + +### Hour 12-24: Stabilization Phase +- Consistent opportunity detection +- **5-10 execution attempts** +- **1-3 successful executions** +- Total profit: $0.05-$0.50 + +--- + +## ⚠️ IMPORTANT WARNINGS + +### This is AGGRESSIVE and RISKY + +**With these settings:** +- Some trades WILL lose money (up to $0.02/trade) +- You're competing with PROFESSIONAL bots +- Success rate will be LOW (<10%) +- First 24h is LEARNING phase + +**Monitor Closely:** +- Check logs every 2 hours +- Track cumulative P&L +- Be ready to stop if losing >$0.50 +- Don't expect profits immediately + +### Realistic Expectations + +**Conservative (Likely):** +- Total opportunities: 20-50 +- Profitable opportunities: 1-5 +- Execution attempts: 3-10 +- Successful executions: 0-1 +- Net P&L: -$0.10 to $0.10 + +**Optimistic (Possible):** +- Total opportunities: 50-100 +- Profitable opportunities: 5-15 +- Execution attempts: 10-20 +- Successful executions: 1-3 +- Net P&L: $0.05 to $0.50 + +**Best Case (Unlikely):** +- Total opportunities: 100+ +- Profitable opportunities: 15+ +- Execution attempts: 20+ +- Successful executions: 3-5 +- Net P&L: $0.50 to $2.00 + +--- + +## 🎯 24-HOUR CHECKLIST + +### Hour 2 +- [ ] Bot still running? +- [ ] Blocks being processed? +- [ ] Opportunities detected? +- [ ] Any with profit > $0? + +### Hour 6 +- [ ] Total opportunities with profit > $0: ___ +- [ ] Execution attempts: ___ +- [ ] Cumulative P&L: $___ +- [ ] Any errors to fix? + +### Hour 12 +- [ ] Total profitable opportunities: ___ +- [ ] Total execution attempts: ___ +- [ ] Successful executions: ___ +- [ ] Cumulative P&L: $___ +- [ ] On track for 24h goal? + +### Hour 24 +- [ ] **GOAL MET**: ≥1 profitable execution? YES / NO +- [ ] Total executions: ___ +- [ ] Success rate: ___% +- [ ] Total profit: $___ +- [ ] Lessons learned: ___ + +--- + +## 📝 LOG SNIPPETS TO WATCH FOR + +### GOOD - What You Want To See +``` +✅ Token graph updated with 8 high-liquidity pools +🎯 ARBITRAGE OPPORTUNITY DETECTED +├── Estimated Profit: $0.05 +├── Gas Cost: $0.014 +├── Net Profit: $0.036 ← NON-ZERO! +└── Status: EXECUTABLE ✅ + +🚀 Executing arbitrage opportunity... +✅ Transaction submitted: 0xabc... +✅ Execution successful! Profit: $0.045 +``` + +### BAD - What Indicates Problems +``` +❌ Failed to update token graph +❌ All opportunities rejected +❌ Transaction reverted +❌ Insufficient funds for gas +❌ RPC rate limit exceeded +``` + +--- + +## 🚀 START NOW + +```bash +# 1. Stop any running bot +pkill mev-bot + +# 2. Navigate to project +cd /home/administrator/projects/mev-beta + +# 3. Deploy +GO_ENV=production \ +PROVIDER_CONFIG_PATH=$PWD/config/providers_runtime.yaml \ +nohup ./bin/mev-bot start > /dev/null 2>&1 & + +# 4. Save PID +echo $! > /tmp/mev-bot.pid +echo "Bot started with PID: $(cat /tmp/mev-bot.pid)" + +# 5. Monitor +tail -f logs/mev_bot.log | grep -i "token graph\|opportunity\|executing" +``` + +--- + +## 📞 HELP + +If after 6 hours you see ZERO opportunities with profit > $0: + +1. Check `CRITICAL_FIX_24H_EXECUTION.md` for troubleshooting +2. Verify token graph loaded: `grep "8 high-liquidity" logs/mev_bot.log` +3. Consider lowering threshold to $0.01 (edit config, rebuild, restart) +4. If still nothing, may need infrastructure upgrade (co-location, mempool monitoring) + +--- + +**Generated:** October 29, 2025 04:20 +**Target:** First profitable execution within 24 hours +**Current Status:** Critical bug fixed, aggressive settings applied, ready to deploy +**Action Required:** Deploy NOW and monitor closely + +🚀 **LET'S GO!**