How MEV (Maximal Extractable Value) Works: The Swap Tax
How MEV (Maximal Extractable Value) Works — The Invisible Tax on Your Swap
I got a worse price than my quote on a token swap, and I blamed the DEX. I was wrong. Once I understood how MEV (maximal extractable value) works, I realized nobody had cheated the app — a bot had quietly taxed me between the click and the confirmation. This is a beginner’s map of that tax: how it happens, how to see it after the fact, and how to shrink your exposure without becoming a trader.
I am not a developer. I understand wallets, gas, and slippage, but this was a blank spot for me until it cost me money. So I’ll skip the validator-side math and stay in the one chair that matters here — yours, the ordinary swapper who just clicks a button and hopes.
Here’s the plan: I’ll break down the mechanism in plain terms, show you where I was wrong, hand you a defense checklist you can run tonight, and right-size the fear at the end.
What MEV actually is, in one plain sentence
MEV is the profit someone can extract by choosing the order of transactions in a block — including yours.
That’s it. No hacking, no stolen keys. When you submit a swap, it doesn’t teleport into the chain. It sits in a public waiting room first. In that gap, other players read your pending transaction and decide whether they can make money by slotting their own trades around it. The ethereum.org reference on maximal extractable value calls this the value that can be extracted by including, excluding, or reordering transactions. Older docs called it “miner extractable value,” from the proof-of-work days.
The name changed, the tax didn’t.
Think of it like a queue at a bank where anyone can see your slip before you reach the teller. Most people ignore it. A few realize that if they push in front of you, do a quick trade, then step back behind you, they walk away with the difference. You still get served. You just get served at a worse rate, and you rarely notice the bill.
That gap between “I clicked Swap” and “it landed on-chain” is where the extraction lives.

How the pipeline works: mempool, searchers, builders, validators
To see where the tax gets applied, follow your transaction through four stages. This is the part most glossary pages make sound harder than it is.
Stage 1 — the public mempool. After you sign a swap, your wallet broadcasts it to a public waiting area called the mempool. Anyone can watch it. Your intended trade — token, size, slippage tolerance — is visible to the world before it settles.
Stage 2 — searchers. These are bots that scan the mempool for profitable patterns. See a big buy about to hit a pool? A searcher can buy just before you and sell just after. It found the opportunity; now it needs someone to place its transactions in the right order.
Stage 3 — builders. Builders assemble candidate blocks. They take transactions — including a searcher’s — and arrange them in a sequence that maximizes fees and extractable value. Ordering is the whole game. Whoever decides the order decides who profits.
Stage 4 — validators (proposers). A validator is chosen to propose the next block. It usually picks the most profitable block a builder offers, then it lands on-chain. Flashbots’ beginner’s guide to MEV-Boost walks through how this builder–validator market runs today under proposer-builder separation.
So the chain of custody is: your intent → public mempool → searcher spots it → builder orders it → validator proposes it. Every one of those hands is optional to you and invisible to you. Yet the outcome — your fill price — is decided somewhere in that relay.
This is also why transaction ordering sits at the root of the problem. If you want the deeper “who controls the sequence” story, I unpacked it in my walkthrough of how shared sequencers work — ordering is the lever, and the extraction is what happens when someone pulls it for profit.

The sandwich: the MEV that hits ordinary swappers
Most extraction is arbitrage between exchanges, and honestly, that kind barely touches you. It even helps keep prices aligned. The one that reaches into your wallet is the sandwich attack, so let me draw it clearly.
You want to buy Token X. Your swap is large enough to nudge the pool’s price. A searcher sees it waiting in the mempool. Here’s the three-slice sandwich:
- Front-run (top slice): the bot buys Token X right before you. Its buy pushes the price up.
- Your swap (filling): you buy at the now-higher price. Your slippage tolerance is what lets the fill go through at all.
- Back-run (bottom slice): the bot immediately sells Token X into your buy, at the price your trade just lifted.
The bot pockets the spread. You paid more than the quote you saw. Nothing was hacked. The pool math worked exactly as designed — it just worked against you because your intent was public and your slippage left room.
I want to be precise about the feeling here. You don’t get an error. You don’t get a warning. You get a fill that’s a bit worse than expected, shrug, and move on. That’s why I call it invisible. The tax is real, but it never sends a receipt.
Here’s a compact map of the main extraction types, who runs them, what you actually feel, and your realistic defense.
| Extraction type | Who does it | What you feel | Your defense |
|---|---|---|---|
| Sandwich attack | Searcher bot | Worse fill than your quote | Tight slippage + private RPC |
| Front-running | Searcher bot | Someone bought right before you | Private RPC (skip public mempool) |
| Arbitrage | Searcher bot | Usually nothing | None needed; it aligns prices |
| Liquidation | Searcher bot | Only if you’re the one liquidated | Manage your own loan health |
The table’s point: as a non-trader, sandwiching and front-running are the two rows that actually touch you, and both come down to the same weakness — your swap sat in a public room with room to spare.
Where I was wrong: I blamed the DEX, not the mempool
Here’s the honest part. For weeks I misdiagnosed this completely.
What I tried. When my fills kept landing worse than the quote, I did what felt logical. I switched DEXs. I refreshed for “better” quotes. I even assumed the app’s fee was sneaky. I was hunting for a villain inside the interface.
What broke. None of it helped, because the problem was never inside the app. The quote was honest. The DEX fee was disclosed. The gap opened up after I signed, in the public mempool, in that window between my click and the block. I was auditing the wrong room.
What I changed. I did one boring thing: I read my own transaction on a block explorer. I found my swap, then looked at the transactions immediately before and after it in the same block. There it was — a buy of the same token one slot ahead of mine, and a sell of the same token one slot behind. A textbook sandwich, bracketing me. If you’ve never traced a transaction like this, my guide on how to read on-chain data for beginners shows the exact steps.
What I’d do differently. I’d have stopped blaming the interface far sooner. The fix wasn’t a better app. The fix was keeping my intent out of the public waiting room in the first place. That reframe — from “which app cheated me” to “where was I exposed” — is the whole point of this post.
Seeing it once changed how I swap. You can’t defend against a tax you can’t picture. Now I can picture it.
Reducing your exposure without becoming a trader
This is the section I wish I’d found first. None of it requires bots, alpha, or leverage. It’s plain defense — the kind of boring hygiene that survives a busy Tuesday. Think of these as dials, not a magic switch.
Tighten your slippage tolerance. Slippage is how much worse a fill you’ll accept before the trade fails. Loose slippage is the room a sandwich needs. I set mine tight for liquid tokens — often well under 1% — so an attacker can’t profitably wedge between me and the pool. If a swap keeps failing at tight slippage, that’s a signal the pool is thin, not a reason to crank it wide open.
Use a private RPC / protected endpoint. This is the big one. A private RPC sends your transaction straight to builders through a protected route instead of the public mempool. If searchers never see your pending swap, they can’t sandwich it. Endpoints like Flashbots Protect and MEV Blocker exist for exactly this — you point your wallet’s network setting at their RPC, and your intent stops broadcasting to the whole world. I’m describing them, not endorsing any one; the mechanism is what matters.
Prefer batch-auction DEXs for larger swaps. Some exchanges don’t route your trade individually at all. They collect many orders and settle them together at a shared price through a solver network. When trades clear in a batch, there’s no single victim to front-run. CoW Protocol (CowSwap) is the well-known example. I walked through this whole model in how intent-based DEXs and solver competition work — batch settlement is one of the cleaner structural defenses against front-running and sandwiching, because it removes the ordering game instead of just hiding your order.
Right-size your swaps in thin pools. A giant swap in a shallow pool moves the price a lot, which is exactly the juicy target searchers want. Splitting a big trade, or simply avoiding low-liquidity pools for size, shrinks the prize. Small swaps in deep pools are barely worth a bot’s gas.
Here’s the honest limit of all this. None of these make you immune. Private RPCs can have their own trust assumptions about who sees your order flow. Tight slippage can cause failed trades in volatile moments. Batch DEXs add a small settlement delay. You’re not buying invincibility — you’re moving from “wide open in public” to “a much harder, less profitable target.” For a tax like this, that’s the win.

Right-sizing the fear: structural, not a wallet hack
I want to close the loop on panic, because the word “attack” does a lot of scary work it hasn’t earned.
This tax is not a breach of your wallet. Nobody stole your keys. Nobody drained your balance. Your seed phrase is irrelevant here. The Wikipedia overview of maximal extractable value frames it well: it’s closer to a regressive tax on ordinary users than a heist. It’s structural. It’s baked into how public, ordered blockchains work — the same transparency that lets you verify everything also lets bots read your intent.
So is it illegal? No — it’s a byproduct of the design, and a lot of it (like arbitrage) quietly keeps markets consistent. Calling it a “hack” gives it powers it doesn’t have. Calling it a “tax” gives you the right posture: you can’t abolish it, but you can lower your bill.
That’s the mental shift I keep coming back to. You don’t fight a tax by getting angry at the cashier. You understand where it applies, then you route around the parts you can. My whole defense is boring on purpose — tight slippage, a private RPC, batch settlement for size, sane swap sizing. Boring survives. Clever fades the first busy week.
This tax isn’t a monster in the app. It’s a toll booth in the road between your click and the block. Once you can see the booth, you can pick a quieter road.
FAQ
What is MEV in crypto in simple terms? Maximal extractable value is the profit someone earns by choosing the order of transactions in a block. When you swap tokens, your trade waits in a public area first. Bots can slot their own trades around yours to skim a small profit, which is why your fill can come in worse than your quote.
Is MEV bad for regular users, and how does it affect me? For most swaps, arbitrage extraction doesn’t touch you and even helps align prices. The one that hits you is sandwiching, where a bot buys before you and sells after, nudging your price. You feel it as a fill slightly worse than expected — a small, invisible tax rather than a stolen balance.
What is a sandwich attack and how do I avoid it? A sandwich attack is three trades: a bot buys right before you, your swap fills at the raised price, then the bot sells. Tight slippage removes the room it needs, and a private RPC keeps your pending swap out of the public mempool so no bot sees it coming in the first place.
How do I protect my transactions from MEV? Set a tight slippage tolerance on liquid tokens, and route swaps through a private RPC or protected endpoint so your intent skips the public mempool. For larger trades, batch-auction DEXs that settle many orders at one price remove the single-victim target. None of this needs a bot or any trading skill.
Is MEV illegal, or is it just how blockchains work? It is not illegal — it’s a byproduct of how public, ordered blockchains function. The transparency that lets you verify transactions also lets bots read pending ones. Much of it is ordinary arbitrage. It’s better understood as a structural cost of the system than as a crime or a hack of your wallet.
Who profits from MEV — searchers, builders, or validators? All three share it. Searchers spot the opportunity in the mempool, builders order transactions to capture the value, and validators propose the block and take a cut. It’s a small market with several hands, which is exactly why the tax reaches your swap without any single obvious villain.
The next map in this series
MEV was the moment I stopped trusting the space between my click and the block. The defense that made the biggest difference was seeing the sandwich on a block explorer with my own eyes — proof beats theory.
So the next post in Crypto Mental Models is a hands-on one: I’ll trace a real sandwich attack transaction step by step on an explorer, so you can spot your own the next time a fill lands worse than the quote. If you can read it, you can route around it.
seonjae — Korean office worker documenting his transition into AI systems, agents, and vibe coding — without a CS background. Shipping in public.