Risk & Security
Sandwich Attack
A sandwich attack exploits a pending DEX trade by placing buy and sell orders around it to extract profit from the price movement.
Maximal Extractable Value is the profit block producers can earn by strategically ordering transactions within a block.
MEV, or Maximal Extractable Value (originally called Miner Extractable Value), refers to the profit that block producers — validators on proof-of-stake networks or miners on proof-of-work chains — can capture by strategically reordering, inserting, or excluding transactions within a block before it is finalized on-chain. MEV represents a hidden cost embedded in nearly every blockchain transaction, and understanding it is important for anyone who trades, borrows, or provides liquidity in decentralized finance.
The concept was first formalized in the 2019 research paper "Flash Boys 2.0," which demonstrated that the ability to control transaction ordering creates substantial profit opportunities that are extracted at the expense of ordinary users.
The MEV ecosystem involves several specialized roles. Searchers are automated bots that continuously monitor the mempool — the waiting area for unconfirmed transactions — looking for profitable opportunities. When a searcher spots one, they construct a transaction (or bundle of transactions) designed to capture the profit and submit it with a gas premium to ensure it gets included in the right position within the block.
Block builders assemble these transaction bundles into complete blocks, optimizing for the highest total revenue. On Ethereum post-merge, a proposer-builder separation (PBS) system has emerged where validators (proposers) auction off block construction rights to specialized builders through protocols like MEV-Boost. The builder who offers the highest bid wins the right to construct the block, and the validator collects the bid as revenue.
This infrastructure has professionalized MEV extraction into a competitive, multi-layered industry that processes millions of dollars in value weekly.
Several well-known strategies account for the majority of MEV extraction:
DEX arbitrage is the most straightforward form. When the same token trades at different prices across two decentralized exchanges, a searcher can buy on the cheaper venue and sell on the more expensive one within the same block, pocketing the difference. This form of MEV is generally considered beneficial because it keeps prices consistent across markets.
Liquidations represent another major source. When a borrowing position on a lending protocol becomes undercollateralized, searchers race to trigger the liquidation and claim the liquidation bonus. This is functionally useful for the protocol's health but can result in worse execution for the borrower being liquidated.
Sandwich attacks are the most predatory form. A searcher detects a pending swap in the mempool, places a buy order immediately before it (driving the price up), lets the victim's trade execute at the inflated price, and then sells immediately after for a profit. The victim receives fewer tokens than they otherwise would have, effectively paying an invisible tax.
Front-running more broadly refers to any strategy where a searcher places their transaction ahead of a known pending transaction to profit from the price impact it will cause.
MEV acts as a hidden tax on blockchain users. Unlike explicit fees such as gas costs or protocol fees, MEV extraction is invisible — it manifests as worse swap execution, higher borrowing costs during liquidation cascades, and missed opportunities. Research estimates that billions of dollars in MEV have been extracted from Ethereum users since DeFi's growth in 2020.
For borrowers specifically, MEV affects the speed and cost of liquidations. During periods of high volatility, searchers competing to liquidate positions can drive up gas prices across the entire network, making it more expensive for other users to add collateral or repay debt in time.
The ecosystem has developed several approaches to reduce MEV's harm:
While MEV cannot be eliminated entirely — the ability to order transactions will always create some extractable value — the trend is toward systems that capture MEV and redistribute it to users rather than allowing it to be extracted by sophisticated actors at their expense.
Related Terms
Risk & Security
A sandwich attack exploits a pending DEX trade by placing buy and sell orders around it to extract profit from the price movement.
Risk & Security
Front-running is the act of placing a transaction ahead of a known pending trade to profit from its expected price impact.
Blockchain & Networks
A network participant that verifies transactions and produces new blocks on a proof-of-stake blockchain by staking tokens.
Blockchain & Networks
A gas fee is the transaction cost paid to validators for processing and confirming operations on a blockchain network.