Skip to content
PANTHER

What Is MEV? How Sandwich Attacks Work

The value of ordering transactions, who captures it, and what a sandwich costs you, worked through on the real Uniswap formula. Plus how Ethereum, Base, Arbitrum, BNB Chain, Solana and Robinhood Chain differ, and what protection really covers.

By Panther@0xPnthr

Last reviewed 8 min read

Panther Knowledge cover for guide 005: buy, you, sell, beside one block where a searcher's front-run and back-run surround a swap made with 5% slippage tolerance.
Illustration: Panther Knowledge

Key points

  • MEV is the value that can be extracted by including, excluding or reordering transactions in a block.
  • Searchers find it, builders assemble blocks, relays and validators publish them. Arbitrage and liquidations are useful; sandwiches are taken from users.
  • A sandwich pushes the price to exactly your slippage limit. On a $100,000 swap at 5% slippage, the worked example costs you about $4,750.
  • The same trade at 0.5% slippage leaves the attacker about $491 before gas, often not worth running.
  • Chains without a public mempool (Base, Arbitrum, Robinhood Chain, Solana) change who can see your trade, not whether slippage matters.
  • Private RPCs and wallet protection reduce exposure; every provider says none of them is a guarantee.

When you press swap on a decentralized exchange, your transaction is not executed the moment you sign it. It waits to be put into a block, and whoever orders that block decides what runs before and after it. The value that ordering power can capture has a name: maximal extractable value, or MEV.

Some MEV is useful, and some of it is taken straight out of your trade. This guide explains who extracts it, works through a sandwich attack on the real Uniswap formula so you can see exactly what it costs, compares how Ethereum, Base, Arbitrum, BNB Chain, Solana and Robinhood Chain differ, and is honest about what each protection does and does not cover.

What MEV is

ethereum.org defines it as “the maximum value that can be extracted from block production” beyond the standard block reward and gas fees, by including, excluding or reordering the transactions in a block. The term comes from a 2019 paper, Flash Boys 2.0, which called it “miner extractable value”; after Ethereum moved to proof of stake, “miner” became “maximal”.

The paper also described the first visible symptom: bots in priority gas auctions, “competitively bidding up transaction fees in order to obtain priority ordering,” and clogging the network for everyone else in the process.

Who takes it

  • Searchers run software that scans pending transactions and chain state for profit, and submit their own transactions to capture it.
  • Builders assemble those transactions, plus ordinary ones, into full blocks.
  • Relays collect blocks from many builders and pass the most profitable one along.
  • Validators (proposers) sign and publish the block. On Ethereum, validators can run MEV-Boost, which Flashbots describes as “open source middleware run by validators to access a competitive block-building market.”

Splitting the job between builders and proposers is called proposer-builder separation. In ethereum.org’s words, it “creates an auction market, where builders negotiate with validators selling blockspace.”

The good, the neutral and the bad

Type What happens Who pays
Arbitrage Buy on the DEX where a token is cheap, sell where it is expensive, in one atomic transaction Nobody directly; prices across venues line up
Liquidation Repay an under-collateralised loan on a lending protocol and collect the bonus The borrower who fell below their safety margin, by the protocol’s own rules
Back-running Trade immediately after a transaction that moved a price Nobody directly; your trade executes at the price you expected
Front-running Copy or anticipate a profitable transaction and get in first The original sender, who loses the opportunity
Sandwich Buy right before a large swap and sell right after it The swapper, who gets a worse price

ethereum.org is blunt about the last one: sandwich trading results in “an unequivocally worse experience for users.”

How a sandwich works

A searcher watches for a large pending swap, then places two transactions around it:

  1. Front-run: buy the same token just before the victim, pushing the price up.
  2. Victim: the swap executes at the higher price and receives fewer tokens.
  3. Back-run: sell what was bought in step 1 at the price the victim just pushed even higher.

What makes it possible is your slippage tolerance: the worst price you told the exchange you would accept. MEV Blocker’s documentation puts it directly: “Setting your slippage tolerance too high, however, leaves room for searchers to sandwich your trades.” The attacker’s job is to push the price to exactly your limit, and no further, so your transaction still goes through.

Worked example on the Uniswap v2 formula

A pool holds 1,000 ETH and 2,000,000 USDC, a spot price of $2,000. You swap 100,000 USDC for ETH. Using Uniswap v2’s own getAmountOut (with its 0.30% fee), the quote is 47.483 ETH. You leave the default-looking 5% slippage, so the minimum you accept is 45.109 ETH.

A searcher computes the largest front-run that still lets your trade clear at that minimum:

Step Transaction Result
1 Searcher buys ETH with 53,302 USDC Receives 25.88 ETH; price rises
2 You swap 100,000 USDC Receive 45.109 ETH, 2.37 ETH fewer than quoted (−5.00%)
3 Searcher sells 25.88 ETH Receives 58,198 USDC
Searcher’s gross profit 4,895 USDC, before gas

Now change only your slippage setting, same pool, same trade:

Your slippage tolerance Searcher’s capital needed Searcher’s gross profit Your shortfall vs quote
5% $53,302 $4,895 ≈ $4,748
2% $20,831 $1,962 ≈ $1,899
1% $10,337 $982 ≈ $950
0.5% $5,149 $491 ≈ $475

The attack scales with your tolerance, almost one for one. And the searcher still has to pay gas and outbid other searchers for the slot, so below a certain profit the sandwich is not worth running at all. That is why tight slippage on large trades matters more than any other setting.

What has actually happened

The bots that got robbed (April 2023). On April 3, 2023, a newly created validator exploited a flaw in the MEV-Boost relay: it signed a deliberately invalid block header, the relay revealed the block’s contents anyway, and the validator replaced it with its own block that front-ran sandwich bots’ bundles. Flashbots’ post-mortem puts the loss at about $20 million; CertiK and PeckShield’s figure was about $25 million across five bots in block 16,964,664. Relays were patched so they no longer return a block body to a proposer when publishing fails.

jaredfromsubway.eth. EigenPhi’s May 2023 analysis of the most prolific sandwich bot counted about 238,000 attacks and more than 106,000 victims from late February to May 8, 2023, with $40.65 million in revenue, $34.35 million paid in gas and $6.3 million in profit. Other analysts put its real profit lower, at $3.5 to $4.5 million; extraction figures depend heavily on methodology, so treat any single number as an estimate.

The trend on Ethereum. According to EigenPhi data published by Cointelegraph Research in December 2025, monthly sandwich extraction on Ethereum fell from nearly $10 million in late 2024 to about $2.5 million by October 2025, with average profit per sandwich just above $3 and roughly 70% of attacks linked to the same “Jared” operation. The researchers attribute part of the decline to wider use of MEV protection.

Solana. A Helius report covering December 7, 2024 to January 5, 2025 found one program executing 1.55 million sandwich transactions in 30 days for a profit of 65,880 SOL; Jito estimated nearly half of all Solana sandwiches came from it.

Not every chain works like Ethereum

Whether a sandwich is even possible depends on who can see your transaction before it is ordered.

Network Who sees pending transactions How ordering works
Ethereum A public mempool anyone can watch Builders compete; validators pick the most profitable block (MEV-Boost)
Base (OP Stack) “OP Stack chains do not have a public mempool”; only the sequencer sees it By priority fee, built every 200 ms (“Flashblocks”); ordering is locked once broadcast
Arbitrum One “The mempool stays private” Arbitrum moved from first-come-first-served to Timeboost to a priority-fee policy; its docs say this “does not give anyone the right to see or reorder another user’s transactions”
Robinhood Chain Built on Arbitrum Orbit (Nitro), which orders transactions through a sequencer rather than a public mempool Set by the chain owner; Arbitrum’s docs note that chain owners choose their ordering policy
BNB Chain Public mempool; BNB Chain points users to private RPCs so attackers “cannot see your transaction” Proposer-builder separation through BNB Chain’s builder API (BEP-322)
Solana No global mempool Leaders order transactions; Jito runs bundle auctions for priority. Jito suspended its own mempool in March 2024 after a surge in sandwich attacks

The practical upshot: on a chain without a public mempool, a third-party bot cannot see your pending swap to sandwich it, and Ethereum-style private RPCs do nothing extra there. Your exposure on those chains comes from the sequencer or block producer, which you are trusting either way, and from slippage settings that leave room for anyone who lands next to you.

What protection actually covers

Tool How it works Limits stated by the provider
Flashbots Protect (Ethereum) Sends your transaction to a private mempool, hidden “from frontrunning and sandwich bots”; refunds some MEV Ethereum mainnet; rejects a priority fee of 0; you trust the builders it shares with; switching RPCs before confirmation can expose the transaction
MEV Blocker (Ethereum) Private RPC; searchers may back-run but “cannot frontrun or sandwich”; 90% of back-run value goes to the user “No existing solution can provide full 100% protection”; still set slippage: “you should ALWAYS set slippage control”
CoW Swap Batches orders and settles them at uniform clearing prices, which “makes transaction order irrelevant within the block” Works for swaps routed through CoW Protocol
MetaMask Smart Transactions Auctions transactions privately to trusted builders; on by default; supports Ethereum, Linea, Base, Arbitrum, BNB Smart Chain, Polygon and Robinhood A custom RPC overrides it; “MEV protection is not always guaranteed”
Jito “jitodontfront” (Solana) Marks a transaction so Jito’s block engine only accepts bundles where it is first “May help reduce sandwich attacks but is not guaranteed to do so”; Jito’s engine only

And the settings no tool replaces:

  1. Keep slippage as low as the trade allows. Uniswap’s automatic setting ranges from 0.5% to 5% depending on network cost and size; for a large trade, set it yourself. Too low and the swap reverts, which costs only gas.
  2. Trade in deep pools. Uniswap’s own advice for avoiding sandwiches is “Use large liquidity pools.” Smaller price impact leaves less room; market cap vs. liquidity shows how to size a trade against a pool.
  3. Break up large trades on thin pools. Smaller swaps each move the price less and offer less to extract; this is common practice, not a guarantee.
  4. Prefer a protected route by default on Ethereum, and check what your wallet already does on the chain you use.

Checklist before a large swap

Question Action
How deep is the pool relative to my trade? Check the price impact the DEX quotes; above 1–2%, reconsider size or venue
What is my slippage set to? Set it manually, as low as will reliably fill
Does this chain have a public mempool? Ethereum and BNB Chain: use a protected RPC or wallet setting
Is my wallet’s MEV protection on? MetaMask Smart Transactions, a private RPC, or CoW Swap
Can I split it? Several smaller swaps, or an order type that batches

Sources

  1. 01Maximal extractable value (MEV) · ethereum.orgethereum.org/en/developers/docs/mev/
  2. 02Flash Boys 2.0 (Daian et al., 2019) · arXivarxiv.org/abs/1904.05234
  3. 03MEV-Boost introduction · Flashbots Docsdocs.flashbots.net/flashbots-mev-boost/introduction
  4. 04Flashbots Protect overview · Flashbots Docsdocs.flashbots.net/flashbots-protect/overview
  5. 05Flashbots Protect quick start · Flashbots Docsdocs.flashbots.net/flashbots-protect/quick-start
  6. 06Sandwich attacks · MEV Blocker Docsdocs.mevblocker.io/concepts/mev-attack-types/sandwich-attacks
  7. 07MEV Blocker · MEV Blockermevblocker.io/
  8. 08What is a sandwich attack? · Uniswap Supportsupport.uniswap.org/hc/en-us/articles/19387081481741-What-is-a-sandwich-attack
  9. 09What is price slippage? · Uniswap Supportsupport.uniswap.org/hc/en-us/articles/8643879653261
  10. 10UniswapV2Library.sol: getAmountOut · Uniswap on GitHubgithub.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2Library.sol
  11. 11Post-mortem: April 3rd, 2023 mev-boost relay incident · Flashbotscollective.flashbots.net/t/post-mortem-april-3rd-2023-mev-boost-relay-incident-and-related-timing-issue/1540
  12. 12MEV bot incident analysis · CertiKwww.certik.com/resources/blog/mev-bot-incident-analysis
  13. 13Performance appraisal of jaredfromsubway.eth · EigenPhieigenphi.substack.com/p/performance-appraisal-of-jaredfromsubway-eth
  14. 14jaredfromsubway MEV bot (disputed profit estimates) · The Blockwww.theblock.co/post/230218/jaredfromsubway-mev-bot
  15. 15EigenPhi data: sandwich attacks on Ethereum have waned · Cointelegraph Researchcointelegraph.com/research/exclusive-data-from-eigenphi-reveals-that-sandwich-attacks-on-ethereum-have-waned
  16. 16Solana MEV report · Heliushelius.dev/blog/solana-mev-report
  17. 17Jito Labs suspends mempool · The Blockwww.theblock.co/post/281504/solana-client-jito-labs-axes-mempool-function-following-increase-in-mev-attacks
  18. 18Low-latency transaction send (bundles, jitodontfront) · Jito Docsdocs.jito.wtf/lowlatencytxnsend/
  19. 19OP Stack differences from Ethereum (no public mempool) · Optimism Docsdocs.optimism.io/stack/differences
  20. 20Transaction ordering on Base · Base Docsdocs.base.org/specifications/transactions/transaction-ordering
  21. 21The Sequencer · Arbitrum Docsdocs.arbitrum.io/how-arbitrum-works/sequencer
  22. 22MEV on BNB Smart Chain · BNB Chain Docsdocs.bnbchain.org/bnb-smart-chain/validator/mev/overview/
  23. 23BNB Chain MEV FAQs · BNB Chainbnbchain.org/en/blog/bnb-chain-mev-faqs
  24. 24Batch auctions · CoW Protocol Docsdocs.cow.fi/cow-protocol/concepts/introduction/batch-auctions
  25. 25Smart Transactions · MetaMask Supportsupport.metamask.io/manage-crypto/transactions/smart-transactions/

Responses

Links, wallet addresses and contact details are not allowed.

0/1000

No responses yet. Start the conversation.

Panther Journal — The intelligence brief

Stay ahead of the story.

Free. New investigations delivered when published. Unsubscribe anytime.

Launching something?

Work directly with Panther.

Start a project

More from the library