feat(safety): add comprehensive production safety documentation
- Created .env.production.safe with all safety settings - Conservative profit thresholds (0.05 ETH min) - Strict risk limits (1 ETH max position, 10 ETH daily) - Circuit breaker configuration - Emergency stop mechanisms - Dry-run mode for testing - Created PRODUCTION_DEPLOYMENT_GUIDE.md (20+ pages) - 4-phase deployment sequence (dry-run → testnet → micro-test → scale-up) - Safety mechanisms documentation - Monitoring requirements - Infrastructure requirements - Troubleshooting guide - Legal/compliance warnings - Created SAFETY_CHECKLIST.md (quick reference) - Pre-deployment checklist - Daily/weekly monitoring tasks - Emergency procedures - Capital scale-up guidelines - Red flags and stop criteria Safety Features: ✅ Dry-run mode (simulation only) ✅ Circuit breaker (3 consecutive losses / hourly loss limits) ✅ Emergency stop file-based kill switch ✅ Position size limits ✅ Daily volume limits ✅ Slippage protection (1% max) ✅ Gas price limits (50 gwei max) ✅ Rate limiting (max trades per hour) Production Status: TESTING PHASE - Safe for small-scale testing only Next Steps: 1. Follow deployment guide Phase 1 (dry-run for 24+ hours) 2. Validate profit calculations 3. Test circuit breaker 4. Test on testnet before mainnet 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
179
SAFETY_CHECKLIST.md
Normal file
179
SAFETY_CHECKLIST.md
Normal file
@@ -0,0 +1,179 @@
|
||||
# MEV Bot V2 - Production Safety Checklist
|
||||
|
||||
⚠️ **DO NOT SKIP ANY ITEMS** - Each one prevents potential losses
|
||||
|
||||
---
|
||||
|
||||
## Pre-Deployment (MANDATORY)
|
||||
|
||||
### Configuration
|
||||
- [ ] `.env.production.safe` copied and customized
|
||||
- [ ] `DRY_RUN_MODE=true` initially
|
||||
- [ ] `ENABLE_EXECUTION=false` initially
|
||||
- [ ] Archive RPC provider configured (Alchemy/QuickNode)
|
||||
- [ ] Private key stored securely (hardware wallet recommended)
|
||||
- [ ] All safety limits set conservatively
|
||||
|
||||
### Testing
|
||||
- [ ] 24+ hours dry-run monitoring completed
|
||||
- [ ] Profit calculations manually verified
|
||||
- [ ] Circuit breaker tested (triggers on losses)
|
||||
- [ ] Emergency stop tested (creates file successfully)
|
||||
- [ ] Testnet deployment successful (if applicable)
|
||||
|
||||
### Infrastructure
|
||||
- [ ] Monitoring stack deployed (Prometheus + Grafana)
|
||||
- [ ] Alerting configured (Slack/Discord/Telegram)
|
||||
- [ ] Server meets minimum specs (4 CPU, 8GB RAM)
|
||||
- [ ] Low latency RPC connection verified (<100ms)
|
||||
|
||||
---
|
||||
|
||||
## Deployment Day
|
||||
|
||||
### Initial Launch (Dry-Run)
|
||||
- [ ] Deploy with `DRY_RUN_MODE=true`
|
||||
- [ ] Monitor logs continuously for 24 hours
|
||||
- [ ] Verify opportunities detected correctly
|
||||
- [ ] Check profit estimates look reasonable
|
||||
- [ ] No errors or warnings in logs
|
||||
|
||||
### Switch to Live Trading (If Dry-Run Successful)
|
||||
- [ ] Start with `MAX_POSITION_SIZE=0.1` ETH
|
||||
- [ ] Fund wallet with SMALL amount (0.5-1 ETH max)
|
||||
- [ ] Set `ENABLE_EXECUTION=true`
|
||||
- [ ] Monitor EVERY trade for first hour
|
||||
- [ ] Manually calculate profit/loss for first 10 trades
|
||||
|
||||
---
|
||||
|
||||
## Daily Monitoring (First Week)
|
||||
|
||||
- [ ] Check bot still running
|
||||
- [ ] Review all trades from last 24 hours
|
||||
- [ ] Calculate net P/L (including gas costs)
|
||||
- [ ] Check circuit breaker events
|
||||
- [ ] Review error logs
|
||||
- [ ] Verify wallet balance matches expectations
|
||||
|
||||
**If ANY day shows net loss: STOP and investigate**
|
||||
|
||||
---
|
||||
|
||||
## Weekly Review
|
||||
|
||||
- [ ] Calculate weekly ROI
|
||||
- [ ] Win rate > 60%?
|
||||
- [ ] Gas costs < 30% of profits?
|
||||
- [ ] No unexpected circuit breaker triggers?
|
||||
- [ ] System stable (no crashes)?
|
||||
- [ ] Adjust parameters if needed
|
||||
|
||||
**If unprofitable: DO NOT increase limits**
|
||||
|
||||
---
|
||||
|
||||
## Red Flags - STOP IMMEDIATELY If:
|
||||
|
||||
🚨 **Circuit breaker triggering frequently** (>3 times/day)
|
||||
🚨 **Consecutive losing days** (2+ days)
|
||||
🚨 **Gas costs exceeding profits**
|
||||
🚨 **Unexpected large losses** (>0.1 ETH single trade)
|
||||
🚨 **System errors or crashes**
|
||||
🚨 **RPC connection issues**
|
||||
|
||||
---
|
||||
|
||||
## Emergency Procedures
|
||||
|
||||
### Immediate Stop
|
||||
```bash
|
||||
# Method 1: Emergency file
|
||||
docker exec mev-bot-v2-production touch /tmp/mev-bot-emergency-stop
|
||||
|
||||
# Method 2: Container stop
|
||||
docker stop mev-bot-v2-production
|
||||
|
||||
# Method 3: Kill immediately
|
||||
docker kill mev-bot-v2-production
|
||||
```
|
||||
|
||||
### Post-Stop Actions
|
||||
1. Export all logs for analysis
|
||||
2. Calculate total P/L
|
||||
3. Identify root cause
|
||||
4. Fix issues before restart
|
||||
5. Test fixes on testnet
|
||||
6. Only restart if confident in fix
|
||||
|
||||
---
|
||||
|
||||
## Capital Scale-Up (ONLY if Profitable)
|
||||
|
||||
| Week | Condition | Max Position | Max Daily Volume |
|
||||
|------|-----------|--------------|------------------|
|
||||
| 1 | Testing | 0.1 ETH | 0.5 ETH |
|
||||
| 2 | Profitable Week 1 | 0.25 ETH | 1 ETH |
|
||||
| 3 | Profitable Week 2 | 0.5 ETH | 2 ETH |
|
||||
| 4+ | Profitable Week 3 | 1 ETH+ | 5 ETH+ |
|
||||
|
||||
**Rules:**
|
||||
- Each week must be NET profitable before increasing
|
||||
- ANY losing week = revert to previous limits
|
||||
- NEVER increase >2x in single week
|
||||
|
||||
---
|
||||
|
||||
## Safety Limits (NEVER Exceed Without Testing)
|
||||
|
||||
| Parameter | Conservative | Moderate | Aggressive |
|
||||
|-----------|--------------|----------|------------|
|
||||
| MAX_POSITION_SIZE | 0.1 ETH | 1 ETH | 5 ETH |
|
||||
| MAX_DAILY_VOLUME | 0.5 ETH | 5 ETH | 20 ETH |
|
||||
| MIN_PROFIT_WEI | 0.05 ETH | 0.02 ETH | 0.01 ETH |
|
||||
| MIN_ROI | 5% | 2% | 1% |
|
||||
| MAX_SLIPPAGE_BPS | 100 (1%) | 200 (2%) | 300 (3%) |
|
||||
| MAX_GAS_PRICE_GWEI | 25 | 50 | 100 |
|
||||
|
||||
**Start conservative, increase gradually ONLY if profitable**
|
||||
|
||||
---
|
||||
|
||||
## Required Metrics Tracking
|
||||
|
||||
### Profitability
|
||||
- [ ] Gross profit per trade
|
||||
- [ ] Net profit after gas
|
||||
- [ ] ROI percentage
|
||||
- [ ] Win rate
|
||||
- [ ] Largest win/loss
|
||||
|
||||
### Safety
|
||||
- [ ] Circuit breaker triggers
|
||||
- [ ] Emergency stops
|
||||
- [ ] Daily volume used
|
||||
- [ ] Position size violations
|
||||
|
||||
### Performance
|
||||
- [ ] Trade execution latency
|
||||
- [ ] Gas cost per trade
|
||||
- [ ] Failed transaction rate
|
||||
- [ ] Opportunities detected vs executed
|
||||
|
||||
---
|
||||
|
||||
## Contact & Support
|
||||
|
||||
**Before reaching out:**
|
||||
1. Export logs: `docker logs mev-bot-v2-production > debug.log`
|
||||
2. Calculate exact P/L
|
||||
3. Note specific error messages
|
||||
4. Check this checklist for missed items
|
||||
|
||||
**GitHub Issues:** https://github.com/your-org/mev-bot-v2/issues
|
||||
|
||||
---
|
||||
|
||||
**Remember: It's better to miss opportunities than lose capital**
|
||||
|
||||
**Start small, scale slowly, stop quickly if problems occur**
|
||||
Reference in New Issue
Block a user