MEV Explained: How Sandwich Attacks Steal From Traders
Maximal Extractable Value (MEV) costs DeFi traders hundreds of millions per year. This guide explains sandwich attacks, frontrunning, and how to protect your trades.
MEV (Maximal Extractable Value) is profit extracted by block producers (miners/validators) or bots by reordering, inserting, or censoring transactions. In 2025, over $2B in MEV was extracted from Ethereum users. Most retail traders are unaware they are losing to it on every swap.
What Is a Sandwich Attack?
When you submit a swap with >0.5% slippage tolerance, bots scan the mempool, spot your transaction, and insert: (1) a buy order before yours to push the price up, (2) your transaction at the worse price, (3) a sell order after yours to pocket the spread. You receive fewer tokens; the bot profits the difference.
Other Common MEV Strategies
- Frontrunning: copying your transaction with higher gas to execute first
- Backrunning: trading after a large price-moving transaction
- Liquidation sniping: racing to liquidate undercollateralized positions
- JIT liquidity: just-in-time LP position placed and removed in same block to capture fees
How to Protect Yourself
- Use MEV-protected RPC endpoints like Flashbots Protect or MEV Blocker
- Set tight slippage: 0.1–0.3% for liquid pairs (Steyble does this automatically)
- Use DEX aggregators that route through private mempools
- Trade on L2s: MEV is significantly reduced on Arbitrum and Base