What is MEV?
MEV stands for Miner Extractable Value or Maximal Extractable Value. It represents miners’ total value permissionlessly extracted from the Ethereum network’s users by reordering, inserting, and censoring transactions within the produced blocks.
How does MEV work exactly?
Typically, a block is only added to a chain after validators agree upon the order of transactions in the block and reach a consensus. A Miner creates that block and is in full control of where they decide to place transactions in a block. MEV allows miners to play with the order of transactions in a way that is beneficial to them and allows them to profit off a transaction while asking for a higher gas fee.
Miners and Validators optimise for-profit and tend to select and order transactions based on the highest gas price and transaction fees. Miners can leverage their ability to reorder transactions to extract additional profits from users.
You also need to understand that each new block on the network has a limited amount of space to which transactions can be added. In other words, the network is only able to process a limited number of transactions and needs a way to prioritise transactions. A new block can be created only after the previous one is filled and only after certain intervals. So, to get your transaction processed early, one has to pay a gas premium.
All transactions on such networks will first have to be added to a queue, called mempool, in order to be picked up by the miner. This queue is necessarily public, given the transparency of public blockchains.
Taking advantage of this, front-runners browse through submitted transactions, always looking to identify arbitrage opportunities that have the highest potential ROI. These front-runners pay the miners increased gas fees for the exact same transaction to benefit from arbitraging — of course, the miners select those transactions with the highest gas fees assigned to them.
Given that ETH block times are approximately ~13 seconds, this doesn’t give much time for the MEV strategy to be carried out. Thus, it’s majorly run by bots.
As most blockchains default to gas fees to prioritise transactions, bots compete to be the first in the queue when a block is proposed. Notice that a block proposer has between the confirmation of the last block and the finalisation of the next block to propose a block. As such, the timing of block creation is not fixed, and the only thing the bots can do is outbid other bots in hopes that the block proposer will select their transaction upon finalising the block template. Bots can submit a transaction with a prohibitively high gas fee, which would mean they significantly diminish their profits. More likely, the bots will incrementally outbid each other by monitoring other bot transactions. This means that lower latency provides a competitive advantage to such strategies.
For setting context, DeFi protocols face the highest number of MEV attacks. This disincentivises DeFi traders to execute transactions and exchange tokens on DEXs because miners can extract a hefty portion of their overall trade.
MEV exists on all smart contract-enabled blockchains with a party responsible for transaction ordering, including validators in Proof-of-Stake-based systems like Ethereum 2.0 and rollup providers on Optimistic Rollups.
MEV also comprises the certainty and permanence of blockchain transactions. If the reward potential is high enough, miners become more motivated to propose competing blocks that contain altered transactions, otherwise known as time-bandit attacks. In these situations, there’s a cost to users and other participants as a result. Given that miners have the power to reorder previously mined transactions as they please, this compromises the idea of the blockchain being a secure, predictable, and permissionless environment.
MEV is an inherent property of blockchain protocols, and multiple arguments favour them. One is it irons out knowledge asymmetry and can only be done in the presence of surplus capital, as transaction sizes can also be quite big in nature, which happens quite a lot. But all this comes at the cost of protocol security.
The exploitation of MEV cannot be eradicated without the creation of off-chain markets. But the dilemma here is if all the transaction fees were equal, miners might negotiate with traders to pay the transaction priority out of the protocol.
Now that Ethereum has moved to the Proof of Stake consensus model, it might attempt to slash incentives for validators who attempt re-sequencing; however, MEV profit can always be greater than the reduced rewards.
Some researchers are attempting to combat MEV by creating new protocols focused on fairly ordering transactions.