Skip to content

Defending Against MEV

Defence: where the lines are drawn

This chapter is the other half of MEV. Every earlier page is about how to take MEV; this one is about what you can do when someone wants to take your money.


Four layers, not four strengths

Most writing about "anti-sandwich" covers one thing: private pools. As if keeping a tx out of the public mempool makes sandwiches disappear.

It does not. A private pool only solves "someone sees you early". It does not solve the builder re-ordering at the last second, does not solve you picking the wrong service, does not solve the token itself feeding you a fake quote.

The more useful question: which layer is this line of defence built on?

graph TD Me[The tx you signed] --> L1["Layer 1 User<br/>protected RPC · intent front-end · tight slippage"] Me --> L2["Layer 2 Protocol<br/>batch auction · solver bidding · ring trades"] Me --> L3["Layer 3 Infrastructure<br/>threshold encryption · encrypted mempool · inclusion list"] Me --> L4["Layer 4 Liquidity<br/>AMM curve · dynamic fee · hook"] L1 -.weakest: pushes responsibility to you.-> W1["You carry it"] L4 -.most underrated: asks no one to be honest.-> W4["Into math, not trust"]
Layer Who acts Blocks You pay Main weakness
1 User You Public order flow, sandwich One setup, plus split-order gas Depends on you choosing right; a venue may not offer it; only covers your tx
2 Protocol Venue mechanism The ordering power itself Possibly worse price, longer wait Trust the solver set; the trust boundary just moved
3 Infrastructure The orderer Last-look, censorship Latency, throughput, complexity Not truly landed; stuck on engineering and politics
4 Liquidity The AMM curve The profit structure of attack Capital efficiency, dev complexity Some designs trade efficiency; hooks amplify attack surface too

The books on each layer

Layer 1: User

Your own choices: private-pool submission, protected RPC, tight slippage, order splitting, avoiding thin pools.

It is weakest because it pushes responsibility to the user. You have to remember the switch, recognise real service from imitation, and any venue that insists on a public pool cleanly bypasses it. It is optional politeness, not structure.

But it is the only layer usable right now. See Wallet protection.

Layer 2: Protocol

The venue does not let you deal with the pool directly. You quote a result ("I want at least X"), competitors bid, whoever can produce it wins.

This layer carries the most real value today. The reason is honest: it is the only layer where the protocol design cancels the attack, rather than moving it from A to B. An order that never entered any AMM pool has no foothold for sandwich profit — not because someone blocked it, but because there is nothing to grab.

The cost is a new trust boundary: the solver set. See Order Flow Auctions.

Layer 3: Infrastructure

Make the orderer unable to see, or make him accountable afterwards. Threshold encryption, TEE, FOCIL, inclusion lists.

This is the only layer that can remove last-look. Layer 2 cancels the ordering advantage inside its own venue; system-wide "the builder takes one last look" still exists.

Also the least mature. Encrypted mempools have yet to replace the existing PBS architecture. See Encrypted mempools.

Layer 4: Liquidity

Change the AMM itself so "computing the victim's cost" is no longer a deterministic gain. Concentrated liquidity, dynamic fees, hooks, MEV-capturing AMM, batch-lazy execution.

This layer is most underrated because it requires no one to be honest. It does not require the RPC service to not cheat, does not require solvers to not collude, does not require the proposer to not read contents. It changes the profit structure of the attack.

The cost is capital efficiency and implementation complexity, and some designs buy back smart-contract risk. See AMM design.


No complete solution

To be clear, these four layers together still have no complete solution:

  • You use an intent network to dodge the pool, but you hand the order to a solver set. Concentrate the set, and value concentrates.
  • You use an encrypted mempool to dodge last-look, but no one knows when it can hold mainnet traffic.
  • You use dynamic fees to make sandwiches expensive, but LVR still eats your LP position.
  • You trust no one, and the cost is writing your own code, hand-computing slippage, watching gas.

This is not "no one has thought of a good way yet". It is that ordering power itself has a price, and every design only decides who pays it.

Where to start

Your role Start here
Retail, want to pay less tuition Wallet protection is enough
Protocol designer, want to remove the ordering advantage Order Flow Auctions → AMM design
Consensus / infrastructure layer Encrypted mempools
Been sandwiched, want to know why Sandwich attacks → come back to Layer 2

Further reading

  • Wallet protection — what a normal user can really do today, ranked by strength.
  • Order Flow Auctions — intent, solver, batch auction, and "who owns the residual".
  • AMM design — the only layer that needs no trust, and its own cost.
  • Encrypted mempools — why last-look is still unsolved.
  • Sandwich attacks — understand the attacked tx first; defence only makes sense after.
  • MEV-Blocker source — the refund model is the clearest production implementation of "MEV back to users"; read it directly.