Developing a trading bot for DEX on Arbitrum
Arbitrum One — L2 with highest TVL among Ethereum rollups. Low gas (Uniswap v3 transaction costs $0.05-0.30 instead of $3-15 on mainnet), high speed (block every ~250ms), rich DEX ecosystem: Uniswap v3, Camelot, GMX, Ramses, Pendle. For trading bots — attractive environment precisely because of cheap gas: strategies with small per-trade profit become profitable.
Arbitrum specifics for trading bots
Sequencer and MEV
Arbitrum uses centralized sequencer (Offchain Labs operator). This means:
- No public mempool in traditional sense — sequencer accepts transactions in queue order
- Classic frontrunning via gas price auction practically absent — sequencer processes transactions in order received (FCFS)
- MEV exists but less than L1 — arbitrage between DEXs remains, sandwich significantly harder
For arb bot good news: less competition from sandwich bots, fair FCFS execution. For strategies depending on front-running — Arbitrum not best environment.
Latency to sequencer critical. Geographically sequencer is in specific datacenter. For competitive arb strategies — close proximity to sequencer endpoint means difference of 10-50ms, which can be decisive.
Nitro and gas pricing
After Nitro transition (August 2022) Arbitrum uses L2 gas price composed of L2 computation + L1 calldata cost. Gas price changes dynamically depending on load. Unlike Ethereum, Arbitrum has no priority fee auction — base algorithm is FCFS.
At high L1 load (Ethereum congestion), L1 calldata cost rises — effective gas on Arbitrum also rises. Bot should account for this when calculating profitability.
Strategies for Arbitrum DEX
Cross-DEX arbitrage
ETH/USDC price on Uniswap v3 Arbitrum differs from Camelot Arbitrum price. Arb bot notices spread, buys cheaper, sells expensive. Accounting for $0.10-0.50 gas — profitable even at 0.1-0.2% spread.
Technically: local cache of pool state (reserves updated via Swap, Sync events), profit calculation without RPC requests, transaction sending on profit > threshold.
// Pseudocode of arbitrage logic
async function checkArb(token0: Address, token1: Address) {
const priceUni = await getUniswapV3Price(token0, token1)
const priceCamelot = await getCamelotPrice(token0, token1)
const spread = Math.abs(priceUni - priceCamelot) / Math.min(priceUni, priceCamelot)
if (spread > MIN_PROFIT_THRESHOLD) {
const optimalAmount = calculateOptimalArbAmount(priceUni, priceCamelot, poolReserves)
const estimatedProfit = calculateProfit(optimalAmount, spread)
const gasCost = await estimateGasCost()
if (estimatedProfit > gasCost * PROFIT_MULTIPLIER) {
await executeArbitrage(optimalAmount, ...)
}
}
}
Spatial arbitrage via flash loans
For strategies without own capital — flash loan via Aave v3 on Arbitrum (available). Borrow at transaction start, arbitrage, return loan + premium (0.05% for most tokens) in same transaction.
On Arbitrum especially attractive: flash loan on $1M costs $500 premium, but transaction costs $0.20-0.50 gas vs $15+ on mainnet.
Lending arbitrage
Interest rates on Aave Arbitrum and Compound v3 Arbitrum diverge on demand/supply imbalance. Bot borrows at low rate, supplies as liquidity to protocol with high rate. Risk: rates change, must monitor position.
MEV-protection for protocol users
If developing not arb bot but trading bot for clients — important to protect their transactions. On Arbitrum Flashbots works via MEV Blocker or direct sequencer submission without public mempool. Additionally — use commit-reveal scheme to hide transaction intent.
Infrastructure
Node close to sequencer or Arbitrum-specific RPC with low latency (Alchemy Arbitrum, QuickNode). WebSocket for event streaming. Redis for pool state cache. PostgreSQL for trade history and analytics.
Monitoring: Tenderly for debugging failed transactions on Arbitrum (supports simulation), Grafana + Prometheus for bot metrics.
| Component | Solution |
|---|---|
| Language | TypeScript / Rust |
| RPC | Alchemy Arbitrum WebSocket |
| Flash loans | Aave v3 Arbitrum |
| DEX | Uniswap v3, Camelot, GMX |
| Cache | Redis |
| DB | PostgreSQL |
Timeline estimates
Simple cross-DEX arb bot for Arbitrum — 1-2 weeks. Multi-strategy bot with flash loans, monitoring and risk management — 3-5 weeks.
Cost calculated after discussing strategies and infrastructure requirements.







