Frontrunning in Ethereum: What is the Maximal Extractable Value

Maximal Extractable Value
DeFi is full of technical words and phrases, either derived from the financial sector or from computer science. Once we figure out what these mean, the underlying concepts are easier to understand. Maximal Extractable Value (MEV) is one of those terms.

Today we’ll take a look at a term that is exclusive to blockchain tech – maximal extractable value, or MEV. Sometimes you will see people talking about miner extractable value, which refers to MEV specifically on a proof of work network. It obviously makes no sense to talk about miner extractable value on a network that does not have miners (like proof of stake) 

While MEV affects all networks, it is less of an issue on Bitcoin, for reasons we will describe. We’ll use Ethereum as the example, although it is not exclusively an Ethereum challenge. This Twitter thread, for example, describes how MEV impacts Binance Smart Chain. And it is not exclusively a Layer 1 issue either, as it affects the likes of Polygon, Arbitrum, and so on.

To understand MEV, first we have to understand the concept of transaction fees.

What is Maximal Extractable Value?

When Bitcoin was released, its primary purpose was to transfer value from one place to another. You could pay more to speed up your transaction if you needed to, but for most transactions, there was little advantage to be gained. 

However, Ethereum brought the ability to create far more complexity, including Decentralized Finance (DeFi) applications. Decentralized Exchanges (DEXs) sprang up, and suddenly it was possible to make hugely profitable trades where speed of execution was critical.

Examples of this include arbitrage and liquidations. In the case of DEX arbitrage, a trader may spot a difference in the price of a token pair on different DEXs. A smart contract allows that trader to buy on one exchange and sell on the other in a single atomic transaction. This means that there is no risk of them being left unable to sell at the higher price and taking a loss.

Liquidations are another way to profit: protocols such as Aave allow anyone to call in a collateralized loan on behalf of the lender if the collateral falls below a certain point. The liquidator receives a fee for this. 

In both these cases, there will be many traders who spot this opportunity. They use bots to constantly scan the mempool for upcoming transactions and are prepared to pay miners a high fee to ensure their transaction wins the race to execute the contract first.

Spotting profitable transactions and front running them in this way is not illegal because transactions in a blockchain’s mempool are public. The bots that seek out these opportunities are known as searchers. Searchers make money for their creators – but miners still end up with most of the MEV as they ultimately have the power to include or exclude transactions from blocks.

How can networks solve the MEV issue?

To begin with, many people do not see MEV as a problem, but as a necessary consequence of market forces. MEV exists on all smart-contract-enabled networks where node operators are responsible for ordering transactions. Some people argue that it is a necessary ingredient for efficient decentralized finance markets as it aids price discovery and smooths out inconsistencies.

However helpful MEV is for the market as a whole, anything that pushes up fees and promotes front-running is a negative for individual traders. Some initiatives that have aimed to reduce transaction fees have even increased MEV. For example, EIP-1559 which was released as part of Ethereum’s London hard fork last year, removed the variable gas fee that was paid to miners. It was replaced with an algorithmically set fee which was then burned. This was supposed to make fees more predictable – but it meant miners had to rely even more heavily on making revenue from MEV.

Even Ethereum’s move to proof of stake will not have an impact on MEV. Miners will be replaced by validators, and these will have the power to order transactions to take advantage of MEV. Any attempt to change the protocol code itself to disallow this would simply mean MEV payments would happen off-line. 
Meanwhile independent projects such as FlashBots offer the ability to send transactions to miners for priority ordering without submitting them to the public mempool. This means that they cannot be front-run. It is worth having a close look at the FlashBots repositories as the research there makes for interesting reading.