Cross-DEX arbitrage bot for EVM-compatible chains with flash loan support, multi-hop path optimization, and real-time gas profitability calculation.
██████╗ ███████╗██╗ ██╗ █████╗ ██████╗ ██████╗
██╔══██╗ ██╔════╝╚██╗██╔╝ ██╔══██╗██╔══██╗██╔══██╗
██║ ██║ █████╗ ╚███╔╝ ███████║██████╔╝██████╔╝
██║ ██║ ██╔══╝ ██╔██╗ ██╔══██║██╔══██╗██╔══██╗
██████╔╝ ███████╗██╔╝ ██╗ ██║ ██║██║ ██║██████╔╝
╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝
⚡ Cross-DEX Arbitrage Engine ⚡
Cross-DEX arbitrage for EVM-compatible chains
Scan price differentials across Uniswap V2/V3, SushiSwap, PancakeSwap, and other DEXes.
Supports flash loan arbitrage via Aave/dYdX for zero-capital execution with multi-hop path optimization.
|
|
- Python 3.10 or higher
- RPC endpoints for target chains (Alchemy, Infura, QuickNode)
- Private key with native gas token on each chain
- Flash loan contracts deployed (optional, for zero-capital mode)
git clone https://github.com/MercedesSoft8/DEX-Arbitrage-Bot.git
cd DEX-Arbitrage-BotWindows:
run.batLinux / macOS:
chmod +x run.sh
./run.shThe launcher automatically creates a virtual environment and installs all dependencies.
Create a config.json in the project root:
{
"chains": {
"ethereum": {
"enabled": true,
"rpc": "https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY",
"chain_id": 1
},
"bsc": {
"enabled": true,
"rpc": "https://bsc-dataseed.binance.org",
"chain_id": 56
},
"polygon": {
"enabled": true,
"rpc": "https://polygon-rpc.com",
"chain_id": 137
},
"arbitrum": {
"enabled": false,
"rpc": "https://arb1.arbitrum.io/rpc",
"chain_id": 42161
},
"base": {
"enabled": false,
"rpc": "https://mainnet.base.org",
"chain_id": 8453
}
},
"private_key": "YOUR_PRIVATE_KEY",
"flash_loans": {
"provider": "aave",
"enabled": true,
"max_loan_usd": 100000
},
"arbitrage": {
"min_profit_usd": 5.0,
"max_hops": 3,
"slippage_tolerance": 0.005,
"gas_multiplier": 1.2
}
}After launching, select from the interactive menu:
╔══════════════════════════════════════════════╗
║ DEX ARBITRAGE BOT v1.0.0 ║
╠══════════════════════════════════════════════╣
║ [1] Install Dependencies ║
║ [2] Settings ║
║ [3] About ║
║ [4] Scan Arbitrage Opportunities ║
║ [5] Start Auto-Arbitrage ║
║ [6] Configure Chains ║
║ [7] Flash Loan Settings ║
║ [8] Profit Report ║
║ [9] Exit ║
╚══════════════════════════════════════════════╝
[09:15:01] Scanning 3 chains × 4 DEXes — 247 pairs loaded
[09:15:02] ✓ ETH/USDC | Uniswap V3 → SushiSwap | Δ 0.23% | Profit: $12.47 | Gas: $3.80
[09:15:02] ✓ WBTC/WETH | PancakeSwap → Uniswap V2 (BSC) | Δ 0.31% | Profit: $28.90 | Gas: $0.45
[09:15:03] ✗ LINK/USDT | Spread too narrow after gas (Polygon)
[09:15:04] ⚡ Flash loan executed: Borrow 50,000 USDC → 3-hop route → Net: $24.65
DEX-Arbitrage-Bot/
├── main.py # Entry point and menu system
├── config.py # Configuration loader
├── bot_actions.py # Core arbitrage action handlers
├── requirements.txt # Python dependencies
├── run.bat # Windows launcher
├── run.sh # Linux/macOS launcher
├── config.json # User configuration (created on first run)
├── actions/
│ ├── __init__.py
│ ├── about.py # About panel display
│ ├── install.py # Dependency installer
│ └── settings.py # Settings display and setup
├── utils/
│ ├── __init__.py # Environment bootstrap
│ ├── bootstrap.py # Runtime initialization
│ ├── compat.py # Platform compatibility
│ ├── http.py # HTTP client utilities
│ ├── integrity.py # Data integrity checks
│ └── ui.py # Rich console UI components
└── release/
└── README.md # Pre-compiled release info
Which chains are most profitable for arbitrage?
Low-gas chains like BSC, Polygon, and Arbitrum offer more opportunities due to lower execution costs. Ethereum mainnet has larger spreads but requires careful gas management. The bot calculates net profit after gas for each opportunity.
How do flash loans work in this bot?
Flash loans from Aave or dYdX allow borrowing large amounts within a single transaction. The bot borrows tokens, executes the arbitrage route across DEXes, repays the loan + fee, and keeps the profit — all atomically. If the arb is not profitable, the transaction reverts with zero loss.
What is multi-hop arbitrage?
Multi-hop routes involve swapping through intermediate tokens to find the best price path. For example: USDC → WETH → LINK → USDC across different DEXes. The bot uses graph algorithms (networkx) to find optimal paths up to 4 hops.
How often do profitable opportunities appear?
On popular pairs, micro-arbitrage opportunities appear every few seconds but are highly competitive. Less popular pairs and cross-chain opportunities appear less frequently but with larger spreads. The scanner continuously monitors all configured pairs.
Is there a risk of loss with flash loans?
Flash loan transactions are atomic — they either succeed completely or revert entirely. If the arbitrage is not profitable after fees, the transaction reverts and you only lose the gas cost of the failed transaction. The bot pre-calculates profitability to minimize failed attempts.
This software is provided for educational and research purposes only. DEX arbitrage and flash loan usage involve financial and smart contract risk. You are solely responsible for any funds used with this software. The authors assume no liability for financial losses. Always verify smart contract interactions on testnets before mainnet deployment.
Donations — If this tool has been useful, consider supporting development:
0xb92C4d1E83a67F05Df2A19c8E46B70d3C5f8A912
Exploit every basis point across the DeFi landscape.