What is MEV? Maximal Extractable Value Explained

·

MEV, or Maximal Extractable Value, represents a significant and often hidden cost impacting various Ethereum transactions. Whether you're executing a DeFi trade, purchasing an NFT, or providing liquidity, opportunistic actors known as "searchers" can manipulate transaction ordering, leading to unfavorable prices, failed transactions, and lost opportunities. To date, MEV has resulted in over $1.3 billion in lost value for Ethereum users.

This complex phenomenon arises from multiple factors. In this article, we'll explore the causes of MEV, its impact on traders, and practical strategies to safeguard your transactions.

How MEV Works

MEV exploitation is possible due to the flexibility validators have in ordering blockchain transactions to maximize their profits. Proof-of-stake (PoS) blockchains like Ethereum rely on validators to maintain network consensus and add new blocks. These validators, selected at random, decide which transactions are included in a block and their sequence.

When you submit an Ethereum transaction, it first enters the "mempool," a pool of all pending transactions. Validators then select transactions from this mempool to form the next block. Crucially, validators are not required to add transactions in the order they were received. Searchers can pay fees to validators to prioritize or reorder transactions, enabling tactics like frontrunning or backrunning.

Key Concepts and Terminology

To understand MEV, it's essential to grasp several core concepts related to on-chain trading and decentralized exchanges (DEXs).

Automated Market Makers (AMMs)

Automated Market Makers are decentralized trading mechanisms that facilitate real-time asset swaps without traditional order books. They maintain a constant ratio between two assets in a liquidity pool, using the formula x * y = k to determine prices. When a trade alters the pool's balance, prices adjust automatically to maintain this ratio.

Slippage Tolerance

Slippage tolerance is the maximum price difference a trader is willing to accept for their transaction. For example, if ETH is trading at $2,000 and you set a 5% slippage tolerance, you're willing to pay up to $2,100 per ETH. While some slippage is necessary due to market volatility, setting it too high exposes traders to MEV exploitation.

Price Impact

Price impact refers to the effect a trade has on an asset's price due to changes in supply and demand within a liquidity pool. Larger trades cause more significant price impacts, as they deplete available liquidity more substantially.

Transaction Reordering

Transaction reordering occurs when searchers influence validators to arrange transactions in a specific sequence, often by paying fees. This practice is the foundation of most MEV strategies, allowing searchers to capitalize on market movements triggered by other users' transactions.

Types of MEV Attacks

MEV manifests in several forms, each with distinct mechanisms and impacts. Understanding these variants is crucial for recognizing and mitigating their effects.

Frontrunning

Frontrunning involves a searcher executing a transaction ahead of a victim's pending transaction to capitalize on anticipated price movements. This practice disrupts fair market operations, leading to distorted prices and value loss for everyday traders.

How Frontrunning Occurs:

  1. Monitoring: Searchers scan the mempool for high-value transactions likely to influence asset prices.
  2. Analysis: They assess the potential market impact of identified transactions.
  3. Execution: Searchers submit their own transaction with a higher fee, incentivizing validators to prioritize it.

👉 Explore advanced protection strategies

Backrunning

Backrunning occurs when a searcher places a transaction immediately after a victim's transaction to profit from the resulting price impact. Unlike frontrunning, backrunning is considered less harmful, as it doesn't directly exploit the victim's slippage tolerance but captures leftover arbitrage opportunities.

How Backrunning Occurs:

  1. Monitoring: Searchers identify transactions likely to cause significant price impacts.
  2. Identification: They pinpoint transactions that create arbitrage opportunities.
  3. Execution: Searchers place a transaction right after the victim's to capitalize on the price movement.

Sandwich Attacks

Sandwich attacks combine frontrunning and backrunning to maximize searcher profits. They are particularly detrimental, as they force victims to trade at highly unfavorable prices.

How Sandwich Attacks Occur:

  1. Monitoring: Searchers spot large trades in the mempool.
  2. Frontrunning: They place a transaction just before the victim's, pushing the asset price to the victim's slippage limit.
  3. Victim Execution: The victim's transaction executes at the inflated price.
  4. Backrunning: The searcher sells the asset at the new price, profiting from the arbitrage.

Loss-Versus-Rebalancing (LVR)

LVR is a unique form of MEV affecting liquidity providers (LPs). It occurs when arbitrageurs exploit price differences between AMMs and more liquid exchanges, extracting value from LPs. LVR accounts for more value loss than all other MEV types combined, often rendering large liquidity pools unprofitable.

How LVR Occurs:

  1. Price Discrepancy: An AMM's price becomes stale compared to other exchanges.
  2. Arbitrage: Searchers buy assets from the AMM at a discount and sell them on centralized exchanges.
  3. Value Extraction: LPs lose potential profits due to outdated pricing.

Other MEV Variants

Other forms of MEV include Oracle Extractable Value (OEV), where searchers exploit outdated data from oracles. As MEV encompasses any validator activity maximizing block profits, new variants continue to emerge.

Real-World Example: A Sandwich Attack

Consider a trader, Bessie, who wants to buy 4,000 COW with ETH. She sets a 10% slippage tolerance, meaning she's willing to pay up to 1.1 ETH for the tokens.

  1. Transaction Submission: Bessie's trade enters the mempool.
  2. Searcher Action: A searcher spots the trade and frontruns it by buying 4,000 COW for 1 ETH, pushing the price up.
  3. Victim Execution: Bessie's transaction executes at the new price of 1.1 ETH.
  4. Profit Taking: The searcher sells their COW for 1.1 ETH, netting a 0.1 ETH profit.

Bessie ends up paying 10% more than necessary, highlighting the tangible costs of MEV.

Why MEV is Problematic

MEV remains a controversial topic within the Ethereum community. While some argue it enhances market efficiency, others emphasize its negative impacts on everyday users. MEV disproportionately benefits sophisticated actors, eroding market confidence and potentially threatening Ethereum's long-term viability. With sandwich attacks alone generating nearly $1 million weekly for searchers, protecting users is imperative.

How to Protect Yourself from MEV

Several strategies can help mitigate MEV risks, ranging from individual settings to comprehensive technical solutions.

Reduce Slippage Tolerance

Setting a lower slippage tolerance limits the room searchers have to manipulate prices. However, this is not foolproof, as overly low slippage can cause transaction failures, and determined bots may still find exploitation avenues.

Use Custom RPC Endpoints

Specialized RPC endpoints can enhance transaction security by routing trades through protective layers before they reach the mempool. These endpoints often incorporate advanced MEV mitigation features.

MEV Blocker

MEV Blocker is a popular RPC solution that shields users from frontrunning and sandwich attacks. It operates by hiding transactions from the public mempool and allowing only backrunning, with 90% of captured value returned to users as rebates.

Choose MEV-Protected DEXs

Decentralized exchanges with built-in MEV protection, such as those offering auto-slippage features, provide an additional layer of security. Some platforms use batch auctions and intent-based trading to minimize MEV risks.

Frequently Asked Questions

What is MEV in simple terms?
MEV refers to profits extracted by sophisticated actors through manipulating blockchain transaction ordering. It often results in worse prices and failed transactions for regular users.

How can I avoid MEV bots?
Use MEV protection tools like custom RPC endpoints, reduce slippage tolerance appropriately, and trade on DEXs with built-in MEV mitigation features.

Is MEV illegal?
MEV is not inherently illegal but operates in a regulatory gray area. It exploits technical aspects of blockchain design rather than violating specific laws.

Does MEV affect all blockchains?
While most common on Ethereum, MEV can occur on any blockchain where validators or miners can reorder transactions for profit.

What is the difference between frontrunning and backrunning?
Frontrunning executes before a victim's transaction to capture price movements, while backrunning occurs after to profit from residual arbitrage.

Can MEV be eliminated completely?
Complete elimination is challenging, but ongoing developments in protocol design and protective tools are reducing its impact significantly.

Conclusion: The Future of MEV Mitigation

MEV poses a significant challenge to Ethereum's principles of fairness and transparency. As the ecosystem evolves, addressing MEV through innovative solutions is crucial for maintaining user trust and promoting broader adoption. Whether through technical advancements or community-driven initiatives, reducing MEV's impact remains a top priority for ensuring a decentralized and equitable financial system.