Platform Strategies Docs Blog About Launch App

What is MEV?

Maximal Extractable Value (MEV) is the maximum value that can be extracted from transaction ordering, inclusion, and censorship at the block production level. Understanding MEV is essential for effective DeFi trading.

What is MEV?

Maximal Extractable Value (MEV) refers to the maximum value that can be extracted from transaction ordering, inclusion, and censorship during block production. This value arises from the ability to control which transactions get included in a block and in what order.

Transaction Ordering

Miners and validators can reorder transactions to maximize their profits

Transaction Inclusion

Control which transactions enter the mempool and ultimately get included

Censorship Power

Ability to exclude or delay transactions for financial advantage

MEV in Practice

When a user submits a transaction, it enters the mempool (a public pool of pending transactions). Miners and validators can see these transactions before they're included in a block. This visibility creates opportunities to profit by:

  • Reordering transactions to their advantage
  • Adding their own transactions before profitable ones
  • Censoring transactions to reduce competition
  • Front-running large trades to capture arbitrage opportunities

Types of MEV

MEV opportunities come in various forms, each with different characteristics and profit potential. Understanding these types is crucial for developing effective MEV strategies.

Arbitrage MEV

Exploiting price differences between decentralized exchanges. This involves buying from one DEX and selling on another to capture the spread.

Liquidations

Liquidating undercollateralized positions in lending protocols. Liquidators receive rewards for maintaining protocol health.

Sandwich Attacks

Placing trades before and after a target trade to manipulate prices and extract value from the slippage.

Priority Gas Auctions

Competing for transaction inclusion by outbidding other transactions through gas price manipulation.

Frontrunning

Frontrunning occurs when an attacker sees a profitable transaction in the mempool and submits their own transaction with a higher gas price to be included first, thus profiting from the anticipated price movement.

How Frontrunning Works

Frontrunning Example
// 1. Attacker sees large buy order in mempool
// User transaction: Buy 100 ETH @ $2000
// Estimated price impact: +$50

// 2. Attacker submits frontrun transaction
const frontrunTx = {
  to: UNISWAP_ROUTER,
  data: swapExactTokens(
    100000, // Sell 100k USDC
    95,     // Min ETH output (25% less than expected)
    [USDC, ETH],
    attacker,
    deadline
  ),
  gasPrice: "200000000000" // Much higher gas price
};

// 3. Attacker gets filled first, pumps price
// 4. User's order gets filled at worse price
// 5. Attacker immediately sells ETH for profit
Impact: Frontrunning can make large trades significantly more expensive, reducing efficiency and fairness in DeFi markets.

Sandwich Attacks

Sandwich attacks involve placing transactions immediately before and after a target trade, manipulating the price to extract value from the victim's slippage tolerance.

Attack Mechanics

1

Detect Target

Monitor mempool for large trades that will cause significant price impact

2

Front Run

Buy assets before the target trade, pumping the price

3

Victim Trade

Target trade executes at the manipulated (higher) price

4

Back Run

Sell assets after the trade, profiting from the price movement

Arbitrage MEV

Arbitrage opportunities arise when the same asset is priced differently across decentralized exchanges. MEV searchers identify and exploit these differences through rapid execution.

Arbitrage Process

Discovery

Monitor multiple DEXs to identify price discrepancies

Calculation

Calculate potential profit after gas costs and slippage

Execution

Execute trades across multiple DEXs simultaneously

Arbitrage Execution
// ETH Price Discrepancy Found
// Uniswap: 1 ETH = $2,000
// SushiSwap: 1 ETH = $2,050

// Arbitrage Strategy
const arbitrage = {
  buyExchange: 'Uniswap',
  sellExchange: 'SushiSwap',
  asset: 'ETH',
  volume: 100, // 100 ETH
  profit: (2050 - 2000) * 100 - gasCost, // $5,000 - gas
  execution: 'simultaneous' // Critical for success
};

Liquidations

When borrowers' positions become undercollateralized due to price movements, their positions can be liquidated. MEV searchers compete to execute these liquidations to earn liquidation rewards.

Liquidation Process

Health Monitoring

Continuously monitor borrowing positions for health factor drops below 1.0

Fast Execution

Be the first to trigger liquidation to claim the liquidator bonus

Bonus Rewards

Earn percentage of the liquidated position plus protocol incentives

Protocol Benefits: Liquidations maintain protocol solvency and ensure that lending markets remain healthy. Liquidators play a crucial role in DeFi ecosystem stability.