What is MEV: MEV & MEVbots explained
7 Nov 2023 by Harry Newman 4 min read
What is MEV: MEV & MEVbots explained

Maximal Extractable Value or Miner Extractable Value, MEV for short, is a measure of profit a miner can make by arbitrarily including, omitting, or reordering transactions within the blocks they produce. 

Every block consists of a set of transactions, each with its associated gas fees, executed by miners in a predetermined sequence. The order and selection of transactions in a block are typically determined by the miner.


What is MEV and How Does it Work

Phil Daian and a team of smart contract researchers wrote a paper in 2019, called Flash Boys 2.0 which put forward the term miner extractable value, however, an algorithmic trader called Pmcgoohan in 2014 initially predicted this concept within blockchain technology.

MEV is not a new phenomenon, it has existed in another form in traditional financial markets before the creation of cryptocurrencies.

In traditional finance, high-frequency traders search for advantageous positions and use real-time data to capitalize on market volatility.

In the context of blockchain technology, MEV software has been used on the Ethereum blockchain for DeFi applications. 

DeFi platforms allow for the trading of many cryptocurrencies, use of smart contracts and opportunities to capitalize on value extraction.

When Ethereum was on the Proof-of-Work consensus mechanism the process was called miner extractable value. 

Since Ethereum changed consensus mechanisms to Proof-of-Stake in 2022, in a process called The Merge, it is now called maximal extractable value.

Miners can order and validate transactions on the blockchain, as a result, miners can influence the final ordering of these transactions, to extract additional profits.

Miners have found ways to profit off of pending transactions, by including, excluding or recording transactions in any block they mine, with the help of software.


How Does MEV Work

When users initiate a transaction on a blockchain, they have to pay a specific gas fee or transaction cost to incentivize miners to include their transaction in the next block.

These gas fees are awarded to the miner, along with the block rewards.

Miners have the choice of which transaction to include in a block. 

The typical approach is to include transactions with higher gas fees to maximise earnings, this is not the only approach miners take, they can prioritize transactions that benefit their MEV extraction strategies, reshuffling transactions so miners can benefit. 

Other methods of MEV extraction include:

Frontrunning

Miners intercept and reorder transactions to profit from price changes that occur between the submission of a transaction and its inclusion in a block.

Frontrunning is used a lot in DEXs where miners front-run traders' transactions to extract more profits.

A Frontrunning bot replicates the original transaction, but with a higher gas fee, prompting miners to choose that transaction over the first one.

Sandwich Attacks

A sandwich attack is a technique used to manipulate the prices of crypto tokens. Miners insert their own transaction before and after two target transactions, to profit at the expense of the target from an artificial price change.

Sandwich attacks are common on DeFi platforms with Automated market-making algorithms. 

Liquidations

In the DeFi lending space, users can deposit crypto as collateral, but, if a user is unable to support this position any longer and can't repay, most DeFi protocols often allow other participants the chance to compete to find borrowers close to liquidation, so they can gain a liquidation fee from the borrower.


Example of a MEV Bot

Let's say you place an order to buy $1,000 worth of UNI on the Uniswap exchange, this pending transaction goes into a mempool, a database of unconfirmed or pending transactions. 

A MEV bot sees that there is an order to buy UNI on the blockchain, the MEV bot places two orders, one transaction that pays extra gas fees to buy UNI before your transaction and one transaction to sell UNI after your transaction.

Transaction 1: MEV bot executes a buy order, pumping the token price.

Transaction 2: MEV bot victim buys the token at a higher price.

Transaction 3: MEV bot sells the token back into the pool, benefiting from the price difference, the slippage percentage used by the victim affects the price difference, this depends on how much they are willing to tolerate between the trade order and its execution. 


Final Thoughts 

MEV represents a significant and complex challenge for blockchain systems, particularly in DeFi.

As a blockchain community actively addresses MEV-related issues, further developments may aim to mitigate MEV's negative impacts and enhance fairness.

MEV isn't necessarily a bad thing, it can contribute to price improvement, adjusting transactions based on market dynamics, miners can help reduce price disparities.

MEV does come with its challenges, however, MEV presents an opportunity to strengthen the foundations of blockchain technology in the long term.


Want More Cutting-Edge Crypto News? 

Follow Us: X TikTok Instagram Telegram LinkedIn 

Sign up to our newsletter at the bottom of the page

Check Out Our Top 10 Crypto Currencies of 2023

This article is intended for educational purposes and is not financial advice.