Home / Learn / Front-running and MEV, and how to avoid it
Front-running and MEV, and how to avoid it
How value gets extracted from ordinary orders, why the common defences are incomplete, and the one structural fix that removes the opportunity rather than hiding from it.
What MEV actually is
Maximal extractable value is the profit someone can capture purely by choosing the order of transactions in a block. It is not a bug in any particular application. It exists because blockchains process transactions in a sequence, and whoever controls that sequence controls who gets filled first and at what price.
The same logic predates crypto. Traditional markets call it latency arbitrage, and it is the reason firms lay dedicated fibre and build microwave relays between exchanges. In both cases the mechanism is identical: being earlier in a queue is worth money, so people pay to be earlier.
The forms it takes
Sandwiching is the form retail traders notice, because it shows up as slippage on a swap. Stale quote sniping is the more expensive one in aggregate, and almost nobody notices it, because it arrives as permanently wider spreads rather than as a visible loss on any single trade.
- Sandwich attacks — a bot sees your pending buy, buys immediately before you to push the price up, lets your order fill at the worse price, then sells into it. You absorb the difference as slippage.
- Front-running — a bot copies a profitable transaction it observes and submits its own version with higher priority so it executes first.
- Stale quote sniping — the order book equivalent. When the price moves, the fastest trader lifts market maker quotes that have not yet been cancelled, at prices that are no longer fair.
- Liquidation racing — bots compete to be first to liquidate a position, bidding up priority fees for the privilege.
Why it costs more than the visible slippage
The direct cost of a sandwich is easy to see. The indirect cost is larger. Market makers know they will be picked off whenever prices move faster than they can cancel, so they price that expected loss into every quote they post. The result is a spread wider than it would otherwise be, paid by every trader on every trade, including all the trades that were never attacked.
This effect is strongest in options. A maker quoting a full grid of strikes and expiries is exposed at every one of them simultaneously, so a single sharp move in spot leaves many quotes stale at once. That is a significant part of why options spreads are consistently wider than spot spreads across the industry.
The usual defences, and their limits
Every one of these treats extraction as an attack to be defended against. None of them removes the reason it is profitable, which is that a sequence exists and position within it is valuable.
- Slippage limits — cap how bad a fill you will accept. This bounds the damage but does not prevent extraction, and tight limits cause failed transactions in fast markets.
- Private mempools and RPC relays — hide your transaction from public view until it is included. Effective against opportunistic bots, but it shifts trust to the relay operator, who can see your flow.
- Commit-reveal schemes — submit a hidden commitment, then reveal. Adds latency and complexity, and the reveal step often reintroduces ordering games.
- Encrypted mempools — promising, but they conceal transactions rather than removing the value of ordering them.
Removing the opportunity instead
The structural fix is to stop matching in sequence. If all orders received during a window are treated as simultaneous and cleared together at one uniform price, then position in the queue is worth nothing. There is no first transaction to front-run, no victim order to sandwich, and no advantage to arriving sooner.
This is how Rocket matches. Every block is an auction of roughly 100 milliseconds. Orders arriving during the block are batched, aggregate supply and demand are constructed at block close, and a single clearing price is chosen to maximise executable volume. All eligible orders fill at that price, allocated pro-rata at the margin, at their limit price or better.
The distinction matters. A private mempool hides you from extraction that remains profitable and continues happening to others. An auction removes the profitability. Nothing has to be concealed, because there is nothing to gain from seeing an order early.
What to look for in a venue
- Ask how orders are matched. If the answer is continuous or time-priority matching, ordering advantages exist and someone is paying for them.
- Treat MEV protection features as mitigation rather than a solution — they usually indicate the underlying design still rewards ordering.
- Compare live spreads on the same instrument across venues. Structural differences in matching show up there before they show up in marketing.
- Check whether fees are tiered by volume, which is a separate way the same trade can cost more depending on who you are.
Frequently asked questions
What is front-running in crypto?
Observing a pending transaction and placing your own ahead of it to profit from the price impact it will cause. It is possible because blockchains order transactions in a sequence and that ordering can be influenced or bid for.
How do I protect myself from sandwich attacks?
Tight slippage limits and private RPC relays both help, but each has costs — failed transactions in the first case, trusting the relay operator in the second. The complete fix is trading somewhere that does not match orders in sequence at all, since batch auctions leave nothing to sandwich.
Can MEV be eliminated entirely?
Ordering-based extraction can be eliminated within a matching engine that has no ordering. When every order in a block clears simultaneously at one uniform price, there is no sequence to exploit. This is a property of the matching design rather than a filter applied on top of it.
Does MEV affect me if I only place limit orders?
Yes, indirectly and often more than you would expect. Market makers widen their quotes to cover the losses they expect from being picked off, so the wider spread is paid by everyone on every trade, including traders who are never directly targeted.
Trade options onchain
Live BTC and ETH chains with Greeks, payoff plotting and self-custody settlement. Every block is a micro auction, so orders fill at their limit price or better with no latency advantage and nothing to front-run.
Open the BTC options chain