What is MEV in smart contracts?
MEV, maximal extractable value, is the profit available to whoever decides which transactions go into a block and in what order. ethereum.org defines it as the maximum value that can be extracted from block production, and notes it was first called miner extractable value, when miners did the ordering (ethereum.org).
Where does MEV come from?
The ethereum.org page describes searchers who run bots to find these opportunities, and the examples below (ethereum.org).
| Kind | What the searcher does | What the contract can do |
|---|---|---|
| DEX arbitrage | Buys on the cheaper pool and sells on the dearer one, in one atomic transaction | Usually nothing: it keeps prices in line |
| Liquidations | Races to liquidate an unhealthy loan and collect the reward | Size the reward to attract liquidators without overpaying |
| Sandwich | Buys before a large swap and sells right after it | Take a minimum output and a deadline on every swap |
| Front-running | Copies a profitable pending transaction and gets it in first | Bind rewards to the sender, or use commit-reveal |
Sandwiches carry more risk for the searcher than arbitrage because the two trades aren't atomic. Generalized frontrunners copy a profitable pending transaction, put their own address in it and resubmit it with a higher gas price (ethereum.org).
Is MEV a smart contract vulnerability?
Not by itself, since arbitrage and liquidations are part of how DeFi is meant to work. It becomes a bug when a contract hands value to whoever orders transactions: a swap with no minimum output, a reward anyone can claim by copying a pending call, or a price that one trade at the top of a block can set. The SWC registry lists this class as transaction order dependence (SWC-114).
What should a reviewer check?
- Every swap path takes the minimum output from the user, not from a spot price read in the same transaction, as the slippage entry explains.
- Claims and rewards are bound to
msg.senderor a signature, so copying the calldata gains nothing (see front-running). - Liquidation rewards are capped, so a liquidator can't take more than the bonus the protocol intends.
- The result of a function depends on being first in the block only where it has to.
FAQ
Does proposer-builder separation remove MEV?
No, ethereum.org describes it as a way to limit the impact of MEV at the consensus layer, with MEV-Boost as one implementation in which validators pick the highest bid. Transactions are still ordered by someone, so contracts still need minimum outputs and deadlines.
Sources
- Maximal extractable value (MEV), ethereum.org checked 3 December 2026
- SWC-114: Transaction order dependence, SWC Registry checked 3 December 2026