cryptonist
Fibre optic strands gathered into a bundle, their ends lit

DeFi

What MEV is, and what it costs an ordinary swap

Maximal extractable value is the profit available to whoever decides which transactions go into a block and in what order. The term was coined in a 2019 study of bots front-running trades on decentralised exchanges, and it now covers arbitrage, liquidations and sandwiching, most of it routed through a market in which specialised builders bid for the right to fill a block. For someone making an ordinary swap, the part that matters is narrow: how much room the transaction leaves for someone else to trade around it, which the slippage setting decides.

Where the term comes from

The idea was introduced as “miner extractable value” in Flash Boys 2.0, a paper by Philip Daian and seven co-authors submitted to arXiv on 10 April 2019. Its subject was arbitrage bots on decentralised exchanges which, like high-frequency traders, paid high transaction fees and optimised network latency to front-run ordinary users’ trades. The authors documented what they called priority gas auctions, in which bots repeatedly outbid one another’s fees to be placed first in a block.

They then generalised the point. Fees paid for favourable ordering were one case of a wider quantity, which they defined as the total amount of ether miners could extract from manipulating transactions within a given timeframe, possibly across several blocks. Their concern was consensus as much as traders. Where enough value sits in a block, a miner has a reason to fork the chain to take it, and the paper described a “time-bandit” attack in which miners rewrite recent history to capture value that has already been paid out. They presented their measurements of the arbitrage market as lower bounds.

Ethereum no longer has miners. Since the move to proof of stake, validators include, exclude and order transactions, and ethereum.org’s MEV page uses “maximal extractable value” instead, defined as the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding and changing the order of transactions in a block.

Why order is worth money

A transaction’s result depends on the state of the chain at the moment it runs. A swap against an automated market maker is priced from the pool’s reserves when it executes, not when it was signed, so whatever runs just before it changes what it receives. Transactions waiting in the public mempool can be seen before they are included, and the mempool is where ethereum.org says sandwich searchers look, so the information needed to position around a trade is public too.

The Uniswap v2 whitepaper made the point about its own design in 2020. Explaining why an earlier version’s price was unsafe to use as an oracle, it described an attacker buying from a pair, triggering a settlement elsewhere at the inflated price and selling back, and noted that this could be done atomically, or by a miner who controls the ordering of transactions within a block.

The main forms

ethereum.org’s page sets out the well-known opportunities, and three of them account for most discussion.

Arbitrage comes first. When two exchanges quote the same token at different prices, buying on one and selling on the other in a single transaction captures the difference with no exposure, which the page calls “true, riskless arbitrage” and the simplest and most competitive form of MEV. Someone does pay for it: a pool only learns the market price when it is traded against, so the arbitrageur’s profit comes out of the pool. Milionis, Moallemi, Roughgarden and Zhang show that a depositor’s loss against a strategy making the same trades at market prices corresponds to arbitrageurs’ profits. That is a second way of measuring the cost to depositors, beside the comparison with holding that impermanent loss explained works through.

Liquidations are the second form. When a borrower’s collateral falls too far, the page says, lending protocols typically let anyone liquidate it and pay off the lenders, and the borrower usually pays a liquidation fee, some of which goes to the liquidator. That share is the wage for doing the work, and searchers compete to claim it first. How it is set, and why the mechanism depends on someone finding it worth the cost, is covered in how DeFi lending works and in where crypto yield comes from.

Sandwiching is the third, and the one an ordinary user meets. A searcher sees a large pending swap, buys the same token immediately before it, lets the victim’s trade push the price further, and sells immediately after. Uniswap’s pricing documentation describes the same sequence against a naive swap and calls it “fairly cheap and low-risk”. ethereum.org says users who are sandwiched face increased slippage and worse execution. Unlike arbitrage, the profit here comes directly from the user whose trade was surrounded.

The page also counts the first two among MEV’s good effects: arbitrage keeps decentralised exchange prices in line, and lending protocols need prompt liquidations to repay lenders. Sandwiching gets no such defence; the page says it results in an unequivocally worse experience for users.

Searchers, builders and proposers

In theory the block producer captures all MEV, because only it can guarantee an ordering. In practice, ethereum.org says, a large portion is extracted by independent searchers, who run software that finds opportunities and pay for inclusion; for contested opportunities such as arbitrage they may pay 90% or more of the revenue to the validator in fees, since the alternative is losing the trade to someone who bid more.

That bidding now runs mostly through proposer-builder separation, in which specialised builders assemble blocks and the validator chosen to propose a block picks the most valuable one. The motivation section of EIP-7732 says an overwhelming majority of block proposers already outsource the building of their blocks to a third party. ethereum.org’s example of the arrangement is MEV-Boost. Flashbots, which built it, describes it as open-source middleware run by validators to reach a competitive block-building market: builders produce full blocks containing order flow and a fee for the proposer, relays collect blocks from builders and pass on the most profitable, and the validator signs and broadcasts it. Flashbots’ own relay documentation calls relays “doubly-trusted”: builders trust them to route blocks fairly, and proposers trust them for the block’s validity and availability. The arrangement runs outside the protocol, on those trust assumptions.

EIP-7732 itself, enshrined proposer-builder separation, would move the arrangement inside the protocol, making builders staked participants and paying the proposer from the builder’s balance. The Glamsterdam upgrade’s meta EIP, as it stood on 22 November 2026, lists it as scheduled for inclusion, gives a Sepolia test-network activation time of 6 October 2026, and has no mainnet date entered. ethereum.org also raises a wider worry, and presents separation as a way to reduce it, not remove it: larger staking operations can invest more in capturing MEV, which may pull independent validators towards large pools, the kind of pooled staking described in what is liquid staking.

Private order flow

If the public mempool is where front-runners look, one response is not to send the transaction there. Flashbots Protect is one service built on that idea. Flashbots’ overview says transactions sent to it go to a private mempool where they are hidden from front-running and sandwich bots, are included only if they do not revert, and can earn refunds. Its companion, MEV-Share, lets users share selected details of a transaction with searchers, who bid to place a trade straight after it; by default 90% of what that trade earns is paid back to the user, and for now the service accepts only those after-the-fact trades, called backruns.

These are descriptions of how the services say they work, not an assessment of them. The structural point is that private routing changes who sees a transaction, not whether anyone does. Flashbots’ settings guide says every transaction is shared with its own block builder, that users can name others, and that adding builders “requires you to place trust in those builders”. The user is trusting the route in place of the public mempool. ethereum.org names the risk at the far end of that trend, permissioned mempools and “dark pools” open to those who pay, which it says would favour the highest bidder and accelerate centralisation. On a rollup, a separate party orders transactions altogether: OP Mainnet’s fee documentation, for example, says its sequencer executes transactions with higher priority fees first, and layer 2 explained covers how sequencers work.

What it means for an ordinary swap

A swap through a standard router carries its own limit. In Uniswap’s v2 router, swapExactTokensForTokens takes an amountOutMin and reverts unless the trade delivers at least that much, and a deadline after which the transaction is refused. The slippage tolerance in a swap interface is how that minimum is set. Uniswap’s pricing page says that trading with a minimum computed from an observed price keeps losses from front-running “tightly bounded”.

Bounded is the right word, because the minimum is also the attacker’s budget. It sits in the transaction’s data, visible to anyone reading the mempool, and a sandwich can push the user’s result down to it but not past it.

An illustration with invented numbers, ignoring fees and gas. A pool holds 100,000 dollars of stablecoin and 1,000 units of token A. A user swaps $10,000 for A and, with nobody in the way, would receive 90.91 A. The table shows what a sandwich sized to use the whole tolerance does.

ToleranceUser receivesFront-run sizeAttacker’s gross
0.5%90.45 A$263$55
1%90.00 A$528$110
3%88.18 A$1,608$329

The user’s worst case scales with the tolerance, and so does the room for the attacker. Price impact is a separate matter: even with nobody in the way, the user’s average price of 110 is 10% above the pool’s starting price of 100, because a $10,000 trade is 10% of the reserve it pays into, and that part is paid into the pool, not to anyone in the middle.

Setting the tolerance very tight is not free either. A trade whose output falls below the minimum, for any reason including ordinary price movement, reverts. On Ethereum a reverted transaction still pays for the gas it used up to that point, as what gas is explains, so a tolerance too tight for the market can cost fees for nothing. Which balance suits a given trade is not something this piece can settle. What it can say is that the tolerance, the size of the trade against the pool’s depth, and the route the transaction takes are the three things that decide how exposed it is.

What is hard to know

How much MEV there is cannot be read off a dashboard with confidence. Measuring it means recognising patterns in transaction data; the original paper presented its figures as lower bounds, and value taken through private routes or in off-chain agreements leaves less trace on the chain. A sandwich also never appears as a charge. Like the spread that the exchange fees piece describes, it is a worse price rather than a line on a statement.

What can be measured for any one swap is its exposure: its size against the pool it trades with, and the minimum it will accept. On an order book the equivalent question is the depth at the size you trade, which the exchange liquidity piece shows how to check.