Advanced level
MEV (maximal extractable value) is the profit available to whoever controls the order of transactions in a block. Most of it is arbitrage and liquidations, which keep prices aligned and lenders solvent. The harmful kind is the sandwich, where a bot trades just before and after your swap and takes up to your full slippage tolerance. Private routes, orderflow auctions and intent based orders remove the public window a sandwich needs; a tight minimum output limits what any attacker can take.
Ordering is worth money
Maximal extractable value is the profit available to whoever decides which transactions go into a block and in what order. The term started life as "miner extractable value" in the 2019 paper Flash Boys 2.0, which documented bots bidding up gas in priority gas auctions to jump the queue on early DEXs. The M is now read as maximal, which suits proof of stake Ethereum, where validators rather than miners produce blocks. The economics are unchanged: if a pending transaction will move a price, someone can profit by standing next to it.
On Ethereum the work is split between specialists. Searchers run bots that scan pending transactions and new blocks for opportunities and package their trades as bundles. Builders assemble the most valuable block they can from bundles and ordinary transactions. Relays pass the winning block to the proposer, the validator whose slot it is, through MEV-Boost. In the week to late September 2026, relayscan.io recorded relay delivered blocks for roughly nine in ten Ethereum slots, and three builders produced about 92% of those blocks. The full supply chain, and the plan to move this auction into the protocol itself, is the subject of the Expert guide to proposer builder separation.
Competition matters to you in one specific way. Searchers bid against each other for position, so on contested opportunities much of the value ends up paid to builders and proposers rather than kept by the bot. That does not help the user who was extracted from. It does mean that the size of the opportunity your transaction creates, not the cleverness of any one bot, sets what you lose.
The chain also runs on trust. On April 3, 2023, a validator exploited a flaw in widely used relay software: it signed an invalid block header, the relay revealed the block's contents anyway, and the validator rebuilt the block to break apart sandwich bots' bundles, taking about 20 million dollars from them according to the Flashbots post-mortem. Relays were patched to reveal a block only after publishing it successfully. The hunters, it turned out, were also prey.
A field guide to MEV
| Type | What happens | Who pays | Net effect |
|---|---|---|---|
| DEX arbitrage | Buys where a token is cheap and sells where it is dear, across pools or against a centralized exchange | Liquidity providers, through stale prices | Keeps prices aligned across venues |
| Backrun | Trades straight after a large swap to push the moved pool back into line | Liquidity providers | The same, triggered by one transaction |
| Liquidation | Repays an unhealthy loan and takes collateral at a discount | The borrower, through the liquidation bonus | Keeps lending markets solvent |
| Sandwich | Buys just before your swap and sells just after it | You, up to your slippage limit | Pure extraction |
| Just in time liquidity | Adds liquidity for one block around a large swap, then removes it | Passive liquidity providers | A better fill for the trader, fewer fees for LPs |
| Races | Lands first on new pools, mints or oracle updates | Slower participants | Mostly a latency and fee war |
The useful split is not good against evil but who bears the cost. Arbitrage and liquidations extract value, yet they perform a service the system needs, and the people who pay for them, liquidity providers and borrowers, accepted that role when they deposited. A sandwich performs no service. It exists only because a trade was visible before it landed and its minimum output was loose.
Arbitrage and backruns: the benign majority
Take a constant product pool holding 1,000 ETH and 3,000,000 USDC with a 0.3% fee, so ETH is 3,000 in the pool and, for the example, 3,000 everywhere else. Someone buys ETH with 30,000 USDC. With the swap formula from AMM math, they receive 9.8716 ETH, an average of 3,039.03, and leave the pool quoting 3,060.21.
A backrunner now buys ETH at 3,000 elsewhere and sells about 8.41 ETH into the pool until the pool's price, net of the fee, matches the outside market. That makes about 214 USDC before gas and leaves the pool near 3,009, the edge of the band a 0.3% fee allows. Nobody was front run. The swapper got exactly the quote they saw. The 214 dollars came out of the pool's liquidity providers, who sold ETH too cheaply for one block.
That last sentence is the whole economics of providing liquidity. Every arbitrage profit is a loss to LPs compared with trading at the market price, a cost the research literature calls loss versus rebalancing. The guide to LP as a strategy measures it.
Liquidations: MEV that keeps lenders solvent
A lending market cannot sell your collateral itself, so it pays outsiders to do it. When a loan's health factor falls below 1, anyone may repay part of the debt and receive collateral worth more than they repaid. Illustrative numbers, since every market sets its own parameters:
| Step | Value |
|---|---|
| Collateral | 10 ETH at 1,990 = 19,900 USDC |
| Debt | 16,500 USDC |
| Liquidation threshold 82.5% | Health factor = 19,900 × 0.825 ÷ 16,500 = 0.995 |
| Liquidator repays half the debt (a 50% close factor) | 8,250 USDC |
| Collateral received with a 5% bonus | 4.3530 ETH, worth 8,662.50 USDC |
| Gross profit before gas and the swap back to USDC | 412.50 USDC |
Liquidators race for these, and the race often starts when an oracle update lands: the price update is the transaction that makes the loan liquidatable, so bots try to land directly behind it in the same block. The bonus is the borrower's cost, set high enough that someone will always show up in a crash. How it is chosen, and what happens when nobody shows up, is covered in inside a lending protocol and the guide to oracles.
The sandwich, step by step
The bot sees your swap
Your transaction sits in the public mempool with its full calldata, including the minimum output your slippage tolerance produced.
It buys first
The front run buys the token you are buying and pushes its price up. The bot sizes it so your trade still clears at exactly your minimum, because a victim whose trade reverts pays the bot nothing.
Your swap executes at the worse price
You receive your minimum, and your own buy pushes the price further up.
It sells straight after
The back run sells what the bot bought, at the higher price your trade created. All three transactions travel as one bundle, so the bot takes no market risk.
Run it on the same pool and the same 30,000 USDC buy, quoted at 9.8716 ETH. The bot solves for the largest front run your tolerance allows:
| Your slippage tolerance | Front run size | You receive | Your loss vs the quote | Bot gross profit |
|---|---|---|---|---|
| 0.1% | 1,511 USDC | 9.8617 ETH | 30 USDC | 21 USDC |
| 0.5% | 7,577 USDC | 9.8222 ETH | 150 USDC | 105 USDC |
| 1% | 15,211 USDC | 9.7729 ETH | 300 USDC | 210 USDC |
| 2% | 30,655 USDC | 9.6741 ETH | 600 USDC | 420 USDC |
| 5% | 78,440 USDC | 9.3780 ETH | 1,500 USDC | 1,047 USDC |
Three things fall out of the numbers. Your loss is your tolerance times the trade, because the attack is sized to hit your minimum. The bot keeps about 70% of what you lose; most of the rest is the 0.3% fee it pays the pool twice. And the bot's profit is gross: gas and its bid to the builder come out of it, which is why a 0.1% tolerance on a small trade is rarely worth attacking and a 5% tolerance on almost any trade is.
The extreme case happened on March 12, 2025. A swap of about 220,764 USDC into USDT on a Uniswap v3 stablecoin pool returned about 5,271 USDT. According to reports at the time, a bot traded the pool to the edge of its liquidity just before the swap and reversed the trade just after, keeping around 8,000 dollars and paying roughly 200,000 dollars to the block builder for its position. Researchers questioned whether the sender was an ordinary trader at all, but the mechanism holds no mystery: a swap whose minimum output is close to zero is an open offer.
Protection on Ethereum and other EVM chains
Every protection removes one of the two things a sandwich needs: visibility before inclusion, or a loose minimum.
| Route | How it protects | What you rely on | Extras |
|---|---|---|---|
| Private RPC, for example Flashbots Protect | Sends your transaction privately to builders instead of the public mempool | The builders it reaches not to front run you | Included only if it does not revert. MEV-Share refunds, by default 90% of backrun value |
| Orderflow auction RPC, for example MEV Blocker | Searchers may bid to backrun your transaction but may not front run it | The auction rules and the builders that honor them | 90% of the backrun profit paid to the sender in the same block |
| Batch auction, for example CoW Protocol | Orders in a batch clear at one price per direction, so position inside the batch is worthless | Bonded solvers competing on price | Direct matches between traders skip pool fees |
| Dutch auction intents, for example UniswapX or 1inch Fusion | You sign an order and a filler executes it, taking the execution risk | A competitive set of fillers | Gasless for you; a failed fill costs nothing |
Details from the product documentation, as of September 2026: Flashbots Protect has a fast mode that shares your transaction with all registered builders to speed inclusion, and it warns that switching RPCs in some wallets while a protected transaction is pending can rebroadcast it to the public mempool. MEV Blocker, created by CoW Protocol with Beaver Build and Agnostic Relay and operated since January 2026 by Special Mechanisms Group, part of Consensys, offers several endpoints that trade revert protection against rebates. Owners and defaults change; the questions to ask do not. Who sees my transaction, who may act on it, and where does any refund go?
Public mempool
The default path for many wallets
- Every searcher sees your calldata and your minimum output
- Sandwichable up to your full tolerance
- A reverted swap still pays gas
- Every builder can include it, so inclusion is fast
Protected route
Private RPC, orderflow auction or intent
- No public window for a sandwich
- Backrun value can be refunded to you
- Many routes never charge for a failed transaction
- You trust the builders or solvers who do see your order
- Inclusion can take longer if few builders receive it
Layer 2s
Most rollups run a single sequencer, which makes ordering a question of that sequencer's policy. Arbitrum is a documented example. It ordered transactions first come first served, which its documentation says rewarded latency races and spam, and it now runs Timeboost on Arbitrum One and Nova: an auction sells control of an express lane in 60 second rounds, and everyone else's transactions wait an extra 200 milliseconds by default. The docs state the winner gets only a time advantage, not the ability to see or reorder other transactions, and the mempool stays private. On chains like this the sandwich from a public mempool largely disappears, and MEV shows up as arbitrage competition instead.
Solana: no public mempool, different MEV
Solana has no mempool in the Ethereum sense. RPC nodes forward transactions directly to the validators scheduled to lead the next slots, and a transaction that is not processed expires after roughly 150 blocks, about a minute. There is no global waiting room for bots to watch. That removes the easy version of the sandwich, not the incentive.
Much of Solana's MEV runs through Jito. Validators running the Jito-Solana client connect to Jito's block engine, which accepts bundles: up to five transactions that execute in order, all or nothing, within one slot. Bundles compete on tips, a SOL transfer to one of eight tip accounts with a 1,000 lamport minimum, in auctions the engine runs every 50 milliseconds among bundles that touch the same accounts. Tips flow to validators and their stakers. Ordinary priority is a separate channel: a priority fee, usually priced in micro lamports per compute unit, goes entirely to the validator, while half of the 5,000 lamport base fee per signature is burned.
Sandwiching on Solana moved into private channels instead. Jito ran a mempool service until March 8, 2024, when it shut the service down because searchers were using it to sandwich users. Private mempools run by others took its place, and in June 2024 the Solana Foundation removed a group of validator operators from its delegation program for taking part in them. Two newer defenses are worth knowing, both described in Jito's documentation:
- jitodontfront. Add any valid public key beginning with
jitodontfrontto one of your transaction's instructions (the account need not exist onchain) and Jito's block engine rejects any bundle that places your transaction anywhere but first. Jito calls this a mitigation that applies only to its own block engine, not a complete defense. - BAM. Jito's Block Assembly Marketplace schedules transactions inside trusted execution environments, so pending transactions stay encrypted until execution and the ordering is attested. It went live in early mainnet form on September 25, 2025, and as of mid 2026 a minority but growing share of stake ran it.
For users the lesson is the same as on Ethereum: slippage is the budget an attacker works with. Routers such as Jupiter now estimate it automatically from market conditions, which beats a fixed wide number. The Solana runtime guide covers the fee market underneath.
Checking whether you were hit
Compare the fill with your minimum
Read the token transfers on the transaction. Receiving almost exactly your minimum is a fingerprint of a sandwich, because attacks are sized to it and ordinary drift rarely lands on it to the last unit.
Look at the neighbors
On an EVM explorer, open the block and find the transactions listed immediately before and after yours. A buy of your token just before and a sell just after, from the same contract, is the pattern.
On Solana, look for the bundle
The Jito explorer shows bundles and their tips. A bundle holding a buy, your swap and a sell tells the same story.
Fix the cause
Tighten the tolerance, route through a protected path, split a large trade, or use an intent based order. The guide to reading transactions covers the explorer work in detail.
For the basics of slippage and minimum output, see getting a good fill. The short glossary entries on MEV and sandwich attacks are handy to share with someone newer.
Common questions
Is all MEV harmful?
No. Arbitrage keeps prices consistent across venues and liquidations keep lending markets solvent. Both extract value, mostly from liquidity providers and borrowers who accepted that cost as part of the role. Sandwiches are the clearly harmful kind, because they take value from ordinary users and provide nothing in return.
Does a private RPC stop every kind of MEV?
It removes the public mempool window, which stops sandwiches built from it. It does not stop backruns (some routes refund you part of that value), it does not help if the pool itself is thin, and it asks you to trust the builders who receive your transaction. Your slippage tolerance still matters.
Why would a bot sandwich a small trade?
Bots are automated, so any trade whose gross extractable value exceeds gas plus the builder bid is worth attacking. On cheap chains that threshold is low, which is why a wide tolerance on a small trade can still be taken.
Is there MEV on layer 2s?
Yes, mostly arbitrage and races to be first after a price change. With a single sequencer and a private mempool, public sandwiches are much rarer, and ordering depends on the sequencer's policy, such as first come first served or the Timeboost auction on Arbitrum.
How do I protect a swap on Solana?
Keep slippage tight, especially on thin tokens, and prefer routers and wallets that send transactions through protected paths. Jito's jitodontfront marker blocks bundles that place your transaction anywhere but first, though only in Jito's own block engine.
Who ends up with MEV profits?
Competition pushes most of it to whoever controls block space: builders and proposers on Ethereum, validators and their stakers through tips on Solana. Orderflow auctions and refund programs are attempts to return part of it to the users whose transactions created it.
Where to go next
Next: Order books, RFQ, intents and solvers
Guide 3 of 16 in the Advanced level. Your place is kept on this device, so you can pick up exactly here next time.