MEV explained: what is maximal extractable value and how do sandwich attacks affect traders?
MEV (maximal extractable value) is the profit someone can make by choosing which transactions go into a block and in what order. It was originally called "miner extractable value," and the name changed as proof-of-stake chains replaced miners with validators and specialized block builders.
Why ordering creates value
Pending transactions are often visible before they're confirmed. If a bot sees a large trade about to move a price on a decentralized exchange, it can position itself around that trade.
Common forms
- Arbitrage: closing price gaps between exchanges. This is generally seen as benign and keeps prices aligned.
- Liquidations: racing to liquidate under-collateralized loans in lending protocols.
- Sandwich attacks: a bot buys just before your trade (pushing the price up), lets your trade execute at the worse price, then sells right after. You lose value up to your slippage tolerance.
How ordinary users reduce exposure
- Set a tight slippage tolerance so a sandwiched trade fails rather than fills badly (at the cost of more failed transactions in volatile markets).
- Split very large trades.
- Some wallets and apps offer private transaction routing, which sends trades directly to builders instead of the public mempool.
- Use aggregators that include MEV protection features.
MEV is a structural feature of transparent, open blockchains, and how to limit its harms is an active area of research and debate.
Has a DEX trade ever filled noticeably worse than expected for you? Do you think MEV is a bug or an unavoidable cost of open systems?
Comments · 4
A sandwich attack is basically front-running: someone sees your pending swap, buys ahead of you, lets your trade push the price, then sells. Setting a tight slippage limit helps.
Seeing the transaction pool as a public waiting room helped me understand this. Everyone can see what's about to happen and act on it.
Are there ways of submitting trades privately so they don't show up in the waiting room? Or does that just shift the problem?
There are private submission routes, which keep the trade out of the public waiting room. They reduce this risk, though they have their own trade-offs and trust assumptions.