BOOK A CALL WITH US
August 24, 2024

LEAVE A REQUEST

Launching your own token project? Our experts are ready to help with listing on exchanges, market making, marketing and other solutions

SUBMIT APPLICATION

What Is MEV (Maximal Extractable Value) in and MEV Attacks?

MEV refers to the intentional reordering, inclusion, or exclusion of transactions during the creation of a new block on a blockchain, aimed at maximizing profit. Essentially, it’s about extracting additional value from a block beyond the typical rewards and gas fees by selectively choosing which transactions to process and in what sequence.

This concept is most commonly linked to the Ethereum network, which has a robust decentralized finance (DeFi) ecosystem. The more complex the transactions within a block, such as those involving smart contracts for lending, borrowing, or trading, the greater the opportunities for block producers to increase their profits by manipulating the order, inclusion, or exclusion of specific transactions.

Initially, MEV was closely associated with Ethereum’s proof-of-work (PoW) consensus mechanism, where miners had the power to manipulate transactions within a block to extract extra value. This led to the term Miner Extractable Value, highlighting the miners’ ability to maximize profits by making strategic decisions during block creation. However, with Ethereum’s transition to proof-of-stake (PoS) in September 2022, following The Merge upgrade, the responsibility of block creation shifted from miners to validators.

Even though PoS operates differently from PoW, it doesn’t eliminate the potential for MEV. Validators, like miners before them, can still influence the order and selection of transactions within a block to maximize their profits. Consequently, the term has evolved from Miner Extractable Value to Maximal Extractable Value, reflecting its broader applicability beyond just miners.

How Does MEV Work?

MEV operates by allowing block producers, whether miners or validators, to strategically choose and arrange transactions within a block to maximize their earnings. These block producers play a fundamental role in maintaining blockchain networks by verifying and adding transactions to the blockchain in the form of blocks. This process, depending on the blockchain, is referred to as either mining or validation.

Block producers ensure that the network remains operational by adding new transactions to the chain. They collect transaction data from users and compile it into blocks, which are then appended to the blockchain. The critical point here is that block producers have the discretion to decide which transactions to include in their blocks. Typically, they prioritize transactions that offer the highest fees, as this increases their profits. This is why users often pay higher gas or transaction fees during peak times, hoping to have their transactions processed sooner. As a result, transactions with lower fees may experience delays in being added to the blockchain.

However, there is no strict rule that mandates transactions must be prioritized solely based on fees. In blockchains that support smart contracts, where transactions may contain more complex data, block producers have the opportunity to rearrange, include, or exclude certain transactions to generate additional profits beyond the standard block rewards and fees.

For instance, by selecting specific transactions and arranging them in a particular order, block producers can exploit arbitrage opportunities or trigger on-chain liquidations, resulting in extra financial gains. This practice of manipulating transaction selection and ordering to enhance profit is what defines MEV, encapsulating the process of extracting additional value through strategic transaction management.

Types of MEV

Understanding MEV requires a closer look at the different methods by which participants in the crypto market generate additional value. Below, we will explore some of the common types of MEV found in today’s crypto landscape.

DEX Arbitrage

In traditional finance, arbitrage involves exploiting price differences of an asset across various markets. Similarly, in the crypto space, arbitrage-based MEV takes advantage of token price discrepancies across different decentralized exchanges (DEXs).

In this scenario, participants generate extra profit by buying tokens at a lower price on one exchange and selling them at a higher price on another. They can also profit from price differences within various liquidity pools on the same exchange.

For example, consider the BUSD/SOL trading pair on two separate liquidity pools (LP1 and LP2) on PancakeSwap V2, where the exchange rates are 143 BUSD and 146 BUSD for 1 SOL, respectively.

A participant could exploit this opportunity within the same block by executing the following transactions:

1. Sell 50 SOL in LP2 to receive 7,300 BUSD.

2. Use the 7,300 BUSD to buy SOL in LP1, receiving 51.05 SOL.

In this case, the participant earns a profit of 1.05 SOL, minus the transaction fees. While this might appear as an unfair advantage, arbitrage plays a role in enhancing the efficiency of DeFi markets by helping to align token prices across exchanges.

Liquidations

In decentralized finance, liquidations occur when a borrower’s collateral falls below the required threshold to cover their loan. When this happens, anyone can purchase the collateral at a discount and resell it at a higher price to secure a profit.

In this type of MEV, participants act as liquidators, constantly monitoring the blockchain for loan positions that are eligible for liquidation. Once identified, they acquire the collateral at a reduced price and resell it to gain additional profit.

While liquidations are a normal function in any financial system that allows borrowing, they can sometimes be harmful, particularly in cases referred to as “toxic liquidations.” However, in many cases, liquidations are neutral and contribute to the stability of the financial system by managing risky loan positions.

Sandwich Attacks

Sandwich attacks are a particularly harmful form of MEV, where an attacker strategically places trades around a target transaction to manipulate the asset’s price. This involves executing a trade before the target transaction (front-running) and then placing another trade right after it (back-running). The aim is to capitalize on the price movements caused by the target transaction.

Here’s a simplified breakdown of how a sandwich attack works:

1. The attacker places a buy order, which increases the asset’s price.

2. The target trader buys the asset at this inflated price.

3. The attacker then sells the asset at this higher price, making a profit from the price difference.

Front-running

Front-running is the initial step in a sandwich attack. It involves scanning the blockchain’s mempool for pending transactions that are likely to affect an asset’s price. For example, a sophisticated bot might detect a large buy order for a particular cryptocurrency, which would likely increase the asset’s value once the transaction is confirmed.

To exploit this, the bot places its own buy order for the same asset, paying a higher gas fee to ensure that its transaction is processed before the target transaction.

Back-running

To complete the sandwich attack, the attacker places a sell order right after the target transaction, selling the asset at the now-higher price. This is achieved by setting a lower gas fee for the sell order, ensuring it is processed after the target transaction.

This process reduces the profit that the target trader might have otherwise gained, while the attacker profits from the price fluctuation caused by the target transaction.

MEV Attacks and How to Avoid Them

After exploring various types of MEV, it becomes evident that these attacks can have a significant impact on blockchain participants, particularly in the decentralized finance sector. Below are some strategies to protect against MEV attacks.

RPC Endpoints (MEV Blockers)

MEV blockers are tools designed to protect users from being exploited by MEV tactics. Since MEV relies on rearranging transactions for profit, one way to avoid this is by submitting transactions through a network of searchers who follow specific rules to ensure fair execution.

These blockers work via RPC (Remote Procedure Call) endpoints, a protocol that connects the blockchain to a user’s wallet. Instead of sending transactions to the publicly visible mempool, where malicious actors can intercept them, the transactions are routed to a specialized network of ethical searchers.

These searchers agree not to front-run or sandwich users’ transactions. Instead, they may even return some of the extracted value to users by back-running large trades and sharing a portion of the gains.

Lower Slippage Tolerance

Slippage is the difference between the expected execution price and the actual execution price of a transaction. In volatile markets, this difference can be significant, enabling certain MEV attacks.

By setting a lower slippage tolerance, users can ensure their transactions only execute if the price stays within a specified range. This helps protect against sandwich attacks and unexpected losses.

For instance, if an attacker places a large order before a trader’s transaction, causing a significant price change, the trader’s transaction will be canceled if the price moves beyond their slippage tolerance.

Priority Gas Fees

While choosing lower gas fees is cost-effective, it also increases the risk of slow transaction processing, which can be exploited by attackers. To mitigate this, traders should consider paying higher gas fees for important transactions to ensure quicker processing.

Miners or validators are more likely to prioritize transactions with higher gas fees, making it more difficult and costly for attackers to front-run these transactions.

DEX-Native MEV Protection

Using decentralized exchanges (DEXs) or decentralized applications (dApps) designed to combat MEV can also protect traders. For example, CoW Protocol is a DEX aggregator that uses batch auctions and intents as its trading mechanism to secure better outcomes for users.

In a batch auction, orders are collected in groups and auctioned to execution parties, or solvers, who compete to find the most efficient settlement paths. This method enforces rules that minimize the risk of MEV exploitation.

For more insights and updates on the crypto world, don’t forget to check out our blog at Listing.Help

LEAVE A REQUEST

Launching your own token project? Our experts are ready to help with listing on exchanges, market making, marketing and other solutions

SUBMIT APPLICATION