Skip to main content

MEV Explained: Transaction Ordering and Risks

Maximal extractable value (MEV) is the value that an actor may obtain by influencing transaction inclusion, exclusion or ordering within a blockchain block. It can arise from arbitrage, liquidations and strategies that disadvantage other users. Not all MEV is the same, and observable transactions do not always reveal how economic value was divided among participants.

Blue and white abstract risk illustration for MEV Explained: Transaction Ordering and Risks

Why ordering changes economic outcomes

On many smart-contract chains, transactions interact with shared on-chain state. An order executed before a large swap can face a different decentralised-exchange price from an identical order executed afterwards. Validators and block builders have some control or influence over ordering under the relevant protocol and infrastructure. Searchers compete to identify profitable bundles, but the control and fee arrangements differ among networks.

A simple automated market-maker example

A constant-product trading pool with token reserves X and Y uses an approximate x × y = k relationship before fees. A sufficiently large swap changes the reserve ratio and therefore the next trade’s execution price. Someone who observes a pending large purchase may try to trade before it and sell afterwards. The result depends on fees, slippage limits and exact pool mechanics, and the strategy can fail if sequencing or prices differ.

What a sandwich attack is

In a sandwich strategy, an attacker aims to place one trade just before a victim’s trade and another immediately after, exploiting the price impact and the victim’s acceptable slippage. The victim may receive a worse execution price than they would without the inserted trades. This is a source of harmful MEV, distinct from ordinary arbitrage that reduces price discrepancies between pools. The behaviour and available protections differ across blockchains and routing services.

Worked example: slippage exposure

Suppose an on-chain user intends to swap assets worth $10,000 and the interface permits 2% adverse slippage, meaning the user accepts an outcome up to roughly $200 worse than an initial reference before other adjustments. This tolerance creates potential room for adverse execution, though it does not imply an attacker can capture the full $200. Pool depth, fees, network ordering, transaction reversion and competition determine actual outcomes.

Liquidations and arbitrage

Some DeFi lending protocols reward actors who repay unsafe debt and seize collateral after health thresholds are breached. Competing searchers can bid for priority. Cross-exchange arbitrage can help align prices between markets, although it can create externalities such as higher transaction fees or congested block space. A useful analysis differentiates protocol maintenance activities from strategies that exploit users’ transaction visibility.

Private order flow and builder markets

On some chains, order flow may be routed to private relays or specialised builders rather than a public mempool. The infrastructure can change which parties observe trades before inclusion and who earns the associated value. Using private submission does not automatically guarantee protection against every attack, nor does it eliminate trust and censorship considerations. Assess the service’s actual policies and dependencies.

Costs, limits and network distinctions

MEV opportunities must cover gas fees, failed transactions, priority payments, liquidity and price risks. Public claims about estimated MEV totals may use different definitions and chain data coverage. A strategy that looks profitable in a simulated transaction may lose money when competing bundles execute first. Designs also change as block-production architecture evolves.

How to interpret MEV without speculation

Inspect the chain, transaction ordering, swaps, pool reserves, slippage settings and actual execution prices. Distinguish causation from coincident price moves, and consider whether repeated same-block transactions represent arbitrage, routing or an attack. Use protocol documentation and verified transaction traces instead of assuming every rapid on-chain transaction is malicious.

For additional context on the underlying mechanics and risks, read decentralised finance and liquidity-pool risks.

MEV ordering example: the same pool, different execution

Maximal extractable value concerns the ability to influence transaction inclusion and ordering for economic advantage. The table illustrates one potential sandwich-style pattern without providing an implementation recipe.

StepIllustrative sequencePossible effect
1. A user submits a swapBuy token X against token YPending transaction becomes visible
2. An actor observes the pending tradeSubmits a transaction designed to execute earlierMay change the pool price before user execution
3. The user’s swap executesReceives less token X than originally expectedSlippage rises, subject to transaction limits
4. The actor trades after the userAttempts to reverse the initial positionMay capture value, but execution and gas costs matter
Alternative outcomesTransactions can fail or be reordered differentlyNot every proposed strategy earns a profit

The economic outcome depends on pool liquidity, user-defined slippage limits, network congestion, transaction fees, builder and validator behaviour and protocol protections. A transaction confirmed on-chain does not prove that its price was the best available when the user submitted it. Researchers should distinguish arbitrage that aligns markets from extractive behaviours that increase user execution costs, and should avoid treating every high gas payment as malicious MEV.

Frequently asked questions

Is all MEV harmful?

No. Some forms help liquidate unhealthy loans or align market prices, while others can worsen user execution.

Can low slippage settings reduce sandwich exposure?

They can limit acceptable price deterioration but may increase failed transactions and do not remove every risk.

Is MEV unique to Ethereum?

No. Transaction ordering has economic effects across several blockchain systems.

Sources and further reading

Explore more educational resources in the Traders MBA Education library.