March 20, 2024

What is Maximal Extractable Value (MEV) In Crypto?

What is Maximal Extractable Value (MEV) In Crypto?

Maximal extractable value formerly known as miner extractable value is the maximum profit a block producer( miner or validator) can get by/from manipulating the ordering and arrangement of transactions in a block before they are added to the blockchain. 

The concept started gaining popularity when DeFi protocols and DEXs emerged on the Ethereum network.

The term MEV was coined by Phil Daian and a team of smart contract researchers  who wrote a 2019 paper, “Flash Boys 2.0,” which coined the term “miner extractable value.” For Daian’s team, MEV signified the “total amount of ETH miners can extract from manipulation of transactions within a given time frame.” 

When Ethereum switched from proof-of-work to proof-of-stake in 2022 the term “MEV”  became known as “Maximal Extractable Value”  which refers to the total profit that can be derived if transactions are ordered, included or omitted from a block. 

Understanding How It Works 

Image credit: joeceph.hashnode.dev

To understand MEV we need to understand how blocks are added to the blockchain. 

Blockchains rely on consensus mechanisms to validate transactions on the blockchain, bring the network to a state of agreement and secure the network. 

Depending on the consensus mechanism the people who do this are either called validators or miners, these people are incentivized by block rewards which are new coins and transaction or gas fees for adding new blocks to the network thereby keeping the network running. 

When users send transactions they are usually kept in a place called “mempool” or transaction queue before they are picked up and added to blocks by validators/miners. 

There is no rule when it comes to each transaction that is added to a block, because of this, block producers (validators or miners) usually prioritize transactions with higher fees to get higher profits.

Block producers can therefore pick and choose from thousands of pending transactions to extract the maximum value from a block.

Apart from block producers other players actively participate in MEV usually with the use of bots and algorithms to detect MEV opportunities and automate the extraction process these players are known as “Searchers”. 

Once Searchers spot MEV opportunities in the mempool they quickly place their transaction(s) with higher fees to get their transaction validated first and take advantage of their knowledge of pending transactions to achieve financial gain. 

Some Common Techniques Used To Extract MEV 

Image credit:  joeceph.hashnode.dev

Liquidation

DeFi lending protocols allow users to take out loans against deposited crypto as collateral. If the value of the collateral drops below a certain price, that position is liquidated. 

The smart contracts involved often pay out a reward or fee to the transaction that triggers the liquidation. 

This creates MEV opportunities for searchers or block producers running bots to spot this kind of transaction and compete to insert their liquidation transaction in the block ahead of anyone else so that they can gain the liquidation fee for themselves, thereby extracting the reward value.

Front-running 

This happens when searchers or block producers with knowledge of the transaction queue or the “mempool” that contains future/pending transactions that are yet to be settled take advantage of this knowledge and place their own transaction before the anticipated transaction(s) is/are placed and settled in other to achieve financial gains

When searchers detect a transaction in the mempool that could be profitable to them (usually large orders) their bot replicates the original transaction but with higher gas fees, prompting miners to choose that transaction over the first one when validating transactions and adding them to new blocks. 

(Also read: Understanding And Preventing Front-Running Attacks In Crypto)

DEX Arbitrage

As a result of different levels of demand across different decentralized exchanges prices for the same tokens may be different across different DEXs.

This price discrepancy when wide enough creates an opportunity for MEV extraction. Bots can exploit these situations by buying tokens at a lower price at one exchange and selling them on another exchange at a higher rate. 

DEX arbitrage is considered the simplest form of MEV opportunity and it is seen as a positive consequence of MEV as it helps maintain, correct and align token prices across exchanges and makes the broader DeFi market more efficient. 

Sandwich attack

Here A searcher finds a large trade in the mempool and tries to get in before the particular trade is validated and gets out immediately after the identified trade is validated thus profiting from the temporary and artificial price discrepancy and impact of the large trade. 

Thus the searcher or block producer  “sandwiches” a user’s transaction by submitting one transaction before and one after the user’s transaction. This maximizes profit, again at the expense of unsuspecting users whose trade might be settled at a different price therefore paying a higher rate.

The Impact Of MEV In Crypto 

MEV is a byproduct of the decentralized nature of blockchain technology miners/validators are free to arrange transactions in a block as they see fit. 

This freedom, while integral to the blockchain's decentralization tenet, can lead to situations where miners/validators prioritize transactions that offer them the most fees or MEV, potentially at the expense of other network participants. 

Meanwhile, the incentivized liquidation of collateralized loans helps ensure that lenders get their money back from risky customers. 

The high competition among MEV searchers in practices like sandwich and frontrunning attacks results in gas fee spikes, network congestions and artificially manipulating token prices thus leading to poor experience for users. 

Strategies For Mitigating MEV Exploitation 

Here are a few ways to protect yourself from the “invincible tax” known as MEV.

Slippage Tolerance:  slippage is the difference between the expected price of a trade and the price at which it was executed. 

A slippage tolerance enables users to set a slippage limit to the amount of price movement they are willing to accept thus helping protect against price manipulation from MEV.   

Gas Price Adjustments: adjusting the gas price that suit the size of your transaction can help you get prioritised by validators and miners based on how large your transaction is or help you find a balance between speed of execution and cost.

Trading Platforms with Built-in MEV Protection: some DEXs offer MEV protection to users ensuring that trades of users are executed securely and at the best possible prices. 

Off-chain transactions and batching: This helps to mitigate MEV occurrences as these transactions are taken off-chain and bundled together and settled in a single batch on-chain.This increases the complexity for miners or validators attempting to extract MEV, thereby protecting users.

Although it is going to be quite difficult to completely eradicate MEV since MEV is a result of how blockchain technology works, knowing about it and how to mitigate it is the very first step in avoiding MEV exploitation. 

 

Closing Thoughts 

In conclusion, while completely eradicating MEV may prove challenging due to its inherent nature within blockchain technology, awareness and proactive measures are pivotal in mitigating its impact.

Understanding MEV and adopting strategies to counteract its exploitation are essential steps towards safeguarding the integrity and fairness of crypto transactions. 

[Author’s Note: This article does not represent financial advice, everything written here is strictly for educational and informational purposes. Please do your own research before investing.]

Author: Godwin Okhaifo