Future

Cover image for MEV (Maximal Extractable Value): The Invisible Tax on Every Blockchain Transaction
Ribhav
Ribhav

Posted on

MEV (Maximal Extractable Value): The Invisible Tax on Every Blockchain Transaction

Every time you swap tokens on a DEX, liquidate a loan, or buy an NFT, an invisible middleman silently profits from your transaction. You never see them, never agreed to it, but they extract value. This is MEV—Maximal Extractable Value—and understanding it separates casual users from people who truly grasp how blockchains work. This is day 21 of my 60 Days in Web3 series.

Follow my Journey on Medium | Twitter
Join Web3 for Humans on Telegram!


1. What is MEV? (The invisible tax)

MEV is the maximum amount of value that block producers (miners or validators) can extract by changing the order in which transactions are included, excluded, or reordered in a block.

Think of it like this:

When you submit a swap transaction to a DEX, your transaction doesn't execute immediately. It sits in a mempool—a public waiting room where all pending transactions are visible.

Block producers (validators in Ethereum's Proof-of-Stake) have the power to:

  • Include your transaction.
  • Exclude your transaction.
  • Reorder your transaction relative to others.

Sophisticated bots called "searchers" watch the mempool, spot profitable opportunities, and exploit that power to extract value at your expense.

By 2021, MEV extracted on Ethereum alone reached $78 million. By end of 2021, it hit $554 million. Today, it exceeds $686 million.

That's not profit going to Ethereum or validators. That's value being stolen from users like you.


2. How MEV works: The sandwich attack

The most common and easiest-to-understand form of MEV is the sandwich attack.

Imagine you want to swap 1 ETH for USDC on Uniswap. Here's what happens:

Step 1: You submit your transaction

  • You send a swap: "Give me USDC for my 1 ETH."
  • Your transaction enters the mempool, visible to everyone.

Step 2: The attacker sees it (frontrunning)

  • A bot sees your transaction in the mempool.
  • It predicts: "When this big swap executes, the price of ETH will move. I can profit from that."
  • The bot submits its own transaction before yours with a higher gas fee to ensure it gets included first.
  • That transaction buys a lot of ETH, pushing the price up.

Step 3: Your transaction executes (at a worse price)

  • Your swap executes, but the ETH price is now higher than when you submitted it.
  • You receive fewer USDC than expected.
  • You think: "Wow, I got slippage. That's just how DEXs work."

Step 4: The attacker profits (backrunning)

  • The bot immediately sells the ETH it just bought, now at an inflated price.
  • The bot captures the difference as profit.

Your transaction is "sandwiched" between two attacker transactions, and you lose money without ever knowing why.


3. Types of MEV extraction

MEV isn't just sandwich attacks. Searchers exploit MEV in multiple ways:

a) Arbitrage

  • A token is priced differently on two DEXs.
  • Searcher buys it on the cheaper DEX, sells on the expensive one.
  • Profit = price difference.

This is actually benign—it helps keep prices fair across markets.

b) Liquidations

  • A user's loan on Aave becomes under-collateralized and needs to be liquidated.
  • Many searchers compete to liquidate it first to earn the liquidation bonus.
  • This is good for the protocol (keeps it solvent) but searchers still extract value.

c) Front-running

  • You place a swap that will influence the price.
  • A bot places its transaction before yours, benefits from your trade, then profits.

This is harmful to you.

d) Back-running

  • After your transaction executes, a bot executes a follow-up transaction to capture remaining value.
  • Example: You swap tokens, the price moves, a bot sells into that movement and profits.

4. Why MEV happens (The mempool problem)

All transactions are visible in the mempool before they're confirmed.

This creates a transparency paradox:

  • Blockchains are transparent (everyone can see transactions).
  • But that transparency becomes a weapon when validators can choose the order.

Searchers use:

  • Complex algorithms to spot profitable patterns in pending transactions.
  • High gas fees to outbid normal transactions and ensure their transaction goes in first.
  • Bots that run 24/7 to catch every opportunity.

It's like front-running in traditional finance, except on a blockchain it's automated, continuous, and unavoidable (unless you use special protections).


5. Real impact: How much value are users actually losing?

This is not theoretical. Real users lose real money to MEV every single day.

Example: Sandwich attack on Uniswap

  • You want to swap 10 ETH for USDC.
  • Without MEV, you'd get 30,000 USDC (assuming $3,000/ETH).
  • A sandwich attack happens.
  • You end up getting 28,500 USDC.
  • You lose $1,500 to MEV.

Across millions of transactions, this adds up to hundreds of millions per year.

The insidious part

  • You feel the slippage but think it's normal DEX behavior.
  • You don't realize a bot just extracted value from you.
  • Your wallet shows fewer tokens, but you don't see where they went.

6. Pros and cons of MEV

MEV isn't entirely bad—there's a nuanced side:

Pros (surprisingly)

  • Rapid liquidations keep protocols solvent. If a loan needs liquidation, competition among searchers means it happens fast.
  • Arbitrage improves price efficiency across DEXs.

Cons (the real problem)

  • Users get worse prices than they should. Sandwich attacks inflate slippage.
  • Trust in DEXs decreases. If users know they're being robbed by bots, they avoid on-chain trading.
  • Network centralization risk. Large validators/searchers partnerships can dominate MEV, reducing decentralization.
  • Consensus instability. If MEV exceeds block rewards, validators might be incentivized to reorder previous blocks to extract more MEV.

The bottom line: MEV helps the protocol, hurts regular users.


7. How to protect yourself from MEV

If you're a user swapping tokens, here are real, practical ways to reduce MEV exposure:

a) Set a slippage limit

  • On Uniswap, go to swap settings and set slippage to 0.5% instead of the default 1%.
  • If the price moves more than that, your transaction won't execute.
  • This caps your MEV losses but might cause failed swaps during volatile markets.

b) Use MEV-protected wallets

  • Trust Wallet has built-in MEV protection enabled by default.
  • Flashbots Protect is a private RPC that hides your transaction from bots.
    • Your transaction is sent to a private mempool instead of the public one.
    • Bots can't see it, so they can't sandwich you.
    • Protected >27M transactions to date with >400 ETH in gas refunds.

c) Avoid high slippage tolerances

  • The higher your slippage tolerance (e.g., 5%), the more profit a sandwich attacker can extract.
  • Keep it low.

d) Use limit orders instead of market orders

  • Limit orders execute only at a price you specify.
  • They're immune to sandwich attacks because the attacker can't move the price enough to make a difference.

8. Why this matters for developers

If you're building a DeFi protocol or DEX, MEV is a design consideration, not an afterthought.

Questions to ask:

  • How will my protocol handle liquidations—fairly or in a way that attracts MEV searchers?
  • Should I use a MEV-resistant consensus mechanism?
  • Can I implement private mempools or encrypted transactions so pending trades aren't visible?
  • Should I use MEV-Burn (destroy MEV rather than let validators keep it) to disincentivize extraction?

These decisions affect user experience, fairness, and adoption.


9. The future: MEV-resistant solutions (What's being built)

The Web3 community is working on fixes:

a) Private transaction pools

  • Flashbots Protect hides transactions until confirmation.
  • If your transaction is invisible, bots can't sandwich you.

b) MEV-Burn

  • Some protocols destroy MEV rewards instead of giving them to validators.
  • This removes the incentive to extract MEV in the first place.

c) Encrypted mempools

  • Transactions are encrypted until they're in a block.
  • Even validators can't see pending transactions, so they can't reorder them maliciously.

d) Threshold encryption (emerging)

  • Transactions are revealed only after block inclusion, making reordering impossible.

These are experimental, but they represent the direction: making MEV extraction harder or impossible.


10. Key takeaway

MEV is the "invisible tax" that sophisticated bots extract from every DEX swap, liquidation, and arbitrage opportunity you execute on a blockchain. Sandwich attacks—where your transaction is ordered between two attacker transactions to exploit price movement—cost users hundreds of millions per year. While MEV can help protocols (liquidations, arbitrage), it harms regular users by causing worse prices and hidden losses. As a user, protect yourself with low slippage tolerances and MEV-protected wallets like Flashbots Protect or Trust Wallet; as a developer, treat MEV as a design problem that affects user experience and fairness.


Further resources & readings


Learning in public, Day 21 complete 🚀
Follow my Journey on Medium | Twitter
Join Web3 for Humans on Telegram!

Top comments (0)