MEV in plain English
When you submit a transaction on Ethereum or any blockchain, it doesn't get processed immediately. It sits in a waiting area called the mempool, where it's visible to everyone, including bots.
These bots are constantly scanning the mempool looking for profitable opportunities. They can see your pending transaction and, because they can pay higher gas fees, get their own transactions executed before or after yours. They're basically cutting in line, and they're doing it for profit.
The term "MEV" originally stood for "Miner Extractable Value" when Ethereum used proof of work. Now that Ethereum uses proof of stake, it's been renamed to "Maximal Extractable Value" because validators (not miners) order the transactions. But the concept is the same: whoever builds the block gets to decide the order of transactions within it, and that ordering power is worth money.
How much money? According to Flashbots, over $600 million in MEV was extracted on Ethereum in 2023 alone. The real number is probably higher because not all MEV is tracked.
Types of MEV attacks
Frontrunning
A bot sees your pending transaction to buy a token on a DEX. It copies your trade, pays a higher gas fee to get executed first, and buys the token before you. Your buy then pushes the price up slightly, and the bot sells for a small profit. You end up paying more than you should have.
Frontrunning has existed in traditional finance forever. Wall Street firms pay billions for co-located servers to get microseconds of advantage. In crypto, anyone with a bot and some ETH for gas can do it.
Sandwich attacks
This is frontrunning's meaner cousin. A bot sees your DEX trade in the mempool. It places a buy order just before yours (pushing the price up) and a sell order just after yours (selling into the higher price your buy created). You're the filling in the sandwich. You get a worse price, and the bot pockets the difference.
Sandwich attacks are incredibly common. During high-traffic periods on Uniswap, a significant percentage of swaps get sandwiched. The attack might only extract a few dollars per trade, but across thousands of trades per day, it adds up to millions.
Liquidation hunting
In DeFi lending protocols like Aave and Compound, if someone's collateral drops below a certain threshold, their position can be liquidated. MEV bots compete to be the first to trigger these liquidations because the protocol pays a bonus to the liquidator. This is actually helpful for the protocol's health, but the competition to liquidate creates gas wars that clog the network.
Arbitrage
When a token trades at different prices on different DEXs, bots instantly buy on the cheaper one and sell on the more expensive one, pocketing the difference. This is the most benign form of MEV because it actually helps keep prices consistent across exchanges. Nobody's directly losing money. It's just profit that someone is capturing by being fast.
Just-in-time liquidity
A bot sees a large incoming trade on a DEX. It quickly adds liquidity to the pool just before the trade, earns fees from the trade, then removes liquidity right after. The bot captures fees that would have gone to regular liquidity providers. It's technically not stealing from the trader, but it extracts value from the protocol's LP ecosystem.
The dark forest
There's a famous blog post called "Ethereum is a Dark Forest" by Dan Robinson that perfectly captures the MEV problem. The mempool is like a dark forest where predators lurk, watching for any transaction they can exploit. The moment you broadcast a transaction, bots analyze it in milliseconds and decide if there's profit to be extracted.
This isn't hypothetical. People have lost significant money trying to rescue funds from compromised wallets, only to have MEV bots frontrun their rescue transactions. It's a hostile environment, and most regular users don't even realize they're in it.
The MEV supply chain has become incredibly sophisticated. There are searchers (the bots finding MEV opportunities), builders (who construct blocks optimized for MEV extraction), and relays (who connect builders to validators). It's an entire economy built on transaction ordering.
How MEV affects you
If you've ever swapped tokens on Uniswap, SushiSwap, or any other DEX and noticed the price was slightly worse than expected, MEV might be why. The slippage you set in your swap settings is essentially your tolerance for being sandwiched.
Setting 0.5% slippage means you're OK with getting up to 0.5% less than the quoted price. MEV bots know this and will sandwich you for as much as your slippage allows. Set it too high and bots take more. Set it too low and your transaction might fail.
Beyond direct financial impact, MEV also contributes to higher gas fees during periods of intense MEV competition, slower transaction processing when bots clog the network, and centralization concerns as MEV profits concentrate among a small number of sophisticated actors.
How to protect yourself from MEV
You can't eliminate MEV risk entirely, but you can significantly reduce your exposure:
Use MEV-protected RPCs. Flashbots Protect sends your transactions directly to block builders instead of broadcasting them to the public mempool. If bots can't see your transaction, they can't sandwich it. Wallets like MetaMask now offer MEV protection built in.
Use DEX aggregators with MEV protection. 1inch, CoW Swap, and others have built-in MEV protection. CoW Swap in particular uses batch auctions that make sandwich attacks impossible by design.
Set reasonable slippage. Don't set your slippage to 5% or 10% unless you absolutely have to. Higher slippage gives bots more room to extract from you. 0.5% to 1% is usually fine for major tokens.
Break up large trades. A $100,000 swap is a juicy target. Five $20,000 swaps are less profitable to attack individually. You'll pay more in gas, but you might lose less to MEV.
Use limit orders instead of market swaps. Some DEXs support limit orders that don't go through the mempool in the traditional sense. These are harder for bots to sandwich.
Trade on L2s or alt-L1s. MEV exists on Layer 2s and other chains too, but it's often less severe because the economics are different. Sequencers on rollups have more control over transaction ordering, and some are implementing fair ordering policies.
Flashbots and the fight against MEV
Flashbots is the most important organization in the MEV space. They've built tools and protocols that try to make MEV extraction more fair and transparent rather than just pretending it doesn't exist.
Their flagship product, MEV-Boost, lets validators auction off block building rights to specialized builders. This redistributes MEV profits more broadly instead of concentrating them among a few searcher-builder combos. Most Ethereum validators use MEV-Boost today.
They've also built Flashbots Protect, the private transaction pool mentioned earlier, and SUAVE, an ambitious project to create a decentralized block building network. The goal is to turn MEV from a chaotic arms race into a structured, transparent market.
Is MEV always bad?
Not necessarily. Arbitrage MEV helps keep prices efficient across exchanges. Liquidation MEV keeps lending protocols solvent. These are actually useful functions, even if the profit goes to bots.
The problematic forms are sandwich attacks and frontrunning, where regular users are directly harmed. The crypto industry is working on solutions, but it's an ongoing battle. MEV is a feature of how blockchains work. As long as someone decides transaction ordering, there will be value in that ordering.
Some people argue that MEV is the price we pay for having a permissionless, transparent system. In traditional finance, the same kind of value extraction happens, you just can't see it. At least in crypto, MEV is visible and measurable, which means we can build tools to mitigate it.
The bottom line
MEV is the profit extracted by bots and block producers from reordering your transactions. It costs regular users hundreds of millions per year through sandwich attacks and frontrunning. You can protect yourself by using private transaction relays, MEV-protected DEXs, and sensible slippage settings.
For more on how DEX trading works, check our DEX guide. To understand the broader trading landscape, start there. And hit the glossary for any terms that didn't click.