MEV
MEV
⭐ 1. WHAT IS MEV? (Deep Explanation)
MEV = profit extracted by controlling the ordering of transactions inside a block.
Meaning:
Who controls the order of transactions controls the profits.
Because different order = different outcome.
FOR EXAMPLE:
If Alice buys ETH
and one second later Bob buys ETH
the price is different.
So the person ordering transactions can:
-
insert their own transaction
-
reorder others
-
censor some
-
bundle multiple txs together
…and make money.
⭐ 2. WHY DOES MEV EXIST?
Because:
Blockchains allow:
-
Public mempools
-
Deterministic state machine
-
Known execution rules
-
Transparent AMMs
Since everything is public,
anyone can predict what will happen next if a transaction were executed.
That means:
✔ If someone does a big Uniswap swap → price will jump
✔ If someone is liquidatable → someone will liquidate them
✔ If someone creates arbitrage → someone will execute it
Therefore:
There is money to be made just by ordering transactions correctly.
⭐ 3. MEV = SPECIFICALLY ABOUT TRANSACTION ORDERING
Not about contract bugs
Not about rugpulls
Not about scams
MEV = ordering transactions to extract profit.
⭐ 4. WHO EXTRACTS MEV?
Before Ethereum Merge (PoW):
-
Miners extracted MEV
-
Searchers sent bundles to miners via Flashbots
After Ethereum Merge (PoS):
-
Block proposers (validators) extract MEV
-
MEV-Boost introduced a new system:
-
Searchers
-
Builders
-
Relayers
-
Validators
-
⭐ 5. MEV ACTORS AND THEIR ROLES
🔷 1. Searchers
Independent bots scanning mempool for opportunities.
They:
-
Detect arbitrage
-
Detect liquidations
-
Build transaction bundles
-
Simulate profits
-
Send bundles to builders
🔶 2. Builders
Collect bundles and normal txs → construct the MOST profitable block possible.
Their job:
-
reorder bundled transactions
-
insert searcher’s txs
-
maximize MEV
-
produce block body
🔵 3. Relayers
Middleware ensuring:
-
Builder cannot lie about block
-
Proposer cannot steal searcher’s MEV
-
Deliver block header proofs to validators
🔴 4. Proposers (Validators)
They sign the block that builder gives them.
They get:
-
Tips
-
MEV share
-
Priority fees
This system is called PBS (Proposer–Builder Separation).
⭐ 6. WHERE MEV COMES FROM (REAL SOURCES)
MEV categories:
⭐ A. ARBITRAGE MEV
(DEX to DEX, cross-DEX)
Example:
-
Uniswap price = 2000
-
Sushiswap price = 1990
Searchers quickly buy at Sushi + sell at Uniswap.
MEV: profit from price difference.
⭐ B. SANDWICH ATTACKS
User sends a big swap:
Attacker does:
This is gas bidding → private mempools reduce this.
⭐ C. LIQUIDATIONS (AAVE, Compound)
User loan becomes liquidatable if collateral falls.
Liquidator bots:
-
monitor oracle feed
-
detect liquidations
-
submit liquidation tx
-
profit from liquidation bonus
This is HUGE MEV.
⭐ D. BACKRUNS (internal pools arbitrage)
Example:
-
User swap changes Uniswap price
→ now there is arbitrage between Uniswap and Sushi
→ bot performs backrun swap
⭐ E. AMM–AMM arbitrage
Between:
-
Uniswap v2
-
Uniswap v3
-
Curve
-
Balancer
-
DEX aggregators
Very common.
⭐ F. NFT arbitrage
Buying undervalued NFT → quick relist.
⭐ G. CEX–DEX arbitrage (Cross exchange)
EVM bots detect price misalignment.
⭐ 7. HOW MEV ACTUALLY WORKS IN THE BLOCK LIFECYCLE
Let’s take you through the REAL sequence:
⭐ Step 1 — User broadcasts transaction
It enters the public mempool.
Everyone sees it.
⭐ Step 2 — Searchers simulate it
Searchers simulate:
If they detect profit, they create a bundle:
⭐ Step 3 — Builder selects best bundles
Builder chooses combination of:
-
searcher bundles
-
normal txs
-
optimal ordering
Builder constructs the most profitable block.
⭐ Step 4 — Builder submits to relayer
Relayer:
-
verifies block
-
ensures builder cannot steal searcher’s MEV
-
ensures proposer cannot steal builder’s MEV
⭐ Step 5 — Validator (proposer) signs block
Validator gets priority fees + MEV cut.
⭐ 8. WHY MEV IS INEVITABLE?
Because ANY deterministic blockchain with a public mempool MUST allow:
-
arbitrage
-
liquidations
-
backruns
-
pricing inefficiencies
You cannot prevent MEV.
But you can mitigate harmful MEV.
⭐ 9. TYPES OF MEV
✔ Good MEV (benign)
-
arbitrage
-
liquidations
-
price alignment
-
oracle stability
❌ Bad MEV (toxic)
-
sandwich attacks
-
time bandit attacks
-
frontrunning
-
generalized frontrunning
-
gas sniping
This distinction is important.
⭐ 10. MEV PROTECTIONS
✔ Private mempools (Flashbots Protect)
Hide user tx from attackers.
✔ Intent-based systems (CoW Protocol)
Users submit “what they want”, not raw tx.
✔ DEX MEV protection (UniswapX, CowSwap)
Orderflow auctions reduce sandwiching.
⭐ 11. SUMMARY OF MEV (Deep Understanding)
MEV is the value extracted by:
-
controlling tx ordering
-
inserting txs
-
removing txs
-
simulating mempool
-
building most profitable blocks
Searchers → build profitable bundles
Builders → create most valuable block
Proposers → sign it
Relayers → ensure fairness
MEV is the economic engine that:
-
keeps DeFi prices aligned
-
performs liquidations
-
keeps AMMs efficient
MEV can be both good and harmful.
Comments
Post a Comment