What is maximal extractable value (MEV)?
Written by Alchemy
Reviewed by Brady Werkheiser
While blockchains in general promise a fair, permissionless, and decentralized financial system that accrues value to users, certain trends threaten this promise. One such trend is Maximal Extractable Value (MEV), which denotes the ability of block producers in a blockchain network to extract profits from users through the inclusion, exclusion, or rearrangement of transactions in blocks.
This article will explain the present-day dynamics of MEV, its effects on users and Ethereum, and what is next for MEV and MEV-Boost in a post-merge Ethereum environment.
What is MEV?
Maximal Extractable Value (MEV) concerns the (potential) profits that accrue to entities producing blocks on a blockchain network based on their capacity to include, censor, or re-order transactions within blocks.
The concept of MEV–especially in the context of smart contract platforms, such as Ethereum–first appeared in Flashboys 2.0, a 2019 research study by Ari Juels et al. The researchers showed how MEV dynamics played out in real-time and detailed its effects on users and the blockchain itself. Since then, the MEV space has grown into a million-dollar industry, forcing blockchain researchers to increase efforts aimed at responding effectively to this trend.
“Miner Extracted Value” was the original term used to describe this concept, but was deprecated partly because of Ethereum’s switch to Proof-of-Stake, where validators staking coins–not miners solving proof-of-work problems–produce blocks.
MEV is a by-product of designs adopted in many blockchains in which miners/validators are responsible for building a block and proposing it for addition to the chain. To build new blocks, nodes collect transactions stored in the mempool, which is a location where transactions are stored pending addition to the chain.
However, the blockchain doesn’t enforce rules on the contents (i.e. transactions) of a block or the ordering of transactions in the block. The block producer is free to arbitrarily include, exclude, or reorder transactions however they want. As rational economic actors, block producers will often include, exclude, and re-order transactions based on the transaction fee the sender is willing to pay–which is how MEV became a multi-million dollar industry.
How does MEV work?
Block producers and other actors in the blockchain network leverage various systematic inefficiencies and opportunities to make profit.
Often these MEV profits come at the expense of the ordinary user whose transactions must go through the public mempool before they can be executed. In the public mempool, two things can happen:
1. The Block Producer Captures the Value
The block producer can refuse to process the transaction, so the trader loses the opportunity. They can also decide to capture the opportunity for themselves by copying details of the transaction and creating a similar transaction and including it in a block.
2. Another MEV Bot Starts a Bidding War
Another trader (or trader bot) watching the mempool can copy the transaction details and send a similar transaction to the mempool with a higher gas price, so the block producer executes their trade first. The original sender may increase their transaction fee in response, starting a bidding war of sorts (formally known as a Priority Gas Auction).
Say the arbitrage opportunity described above is worth $1,000 in pure profits (i.e. the total MEV that can be extracted by the block producer. That’s because the block producer ultimately decides the inclusion and position of the transaction in a block. If the block producer decides not to capture the opportunity, the trader’s profit is the difference between the total MEV available and the fee paid to the block producer for processing the transaction.
Why is MEV a problem?
MEV causes multiple problems including attacking traders, increasing network-wide transaction fees, overloading the network, and may have negative implications for blockchain security. Let's explore each one.
1. MEV can lead to “frontrunning” attacks on traders
Frontrunning is when an entity copies a transaction from the mempool and bribes the block producer with a higher gas fee to get their transaction included ahead of the original transaction. Or, in the worst case, the block producer captures the trade opportunity and censors the initial transaction.
Frontrunning causes “slippage” (i.e. the difference between the expected amount of tokens and the amount received). For instance, trader A conducts a swap or buy order after analyzing current token prices, but trader B frontruns the transaction and triggers a price change before trader A’s transaction can execute.
This will either reduce the tokens trader A will receive or cause the trade to fail–if their funds cannot buy the desired amount of tokens at the now-changed price. Not only does this create a bad user experience for traders, but it negates the goal of DeFi to accrue value equitably to all users.
2. MEV can increase transaction fees and network overload
Another effect of MEV-related transactions is the pressure they put on network-wide transaction fees. Because MEV opportunities are very lucrative, traders and bots are incentivized to express a preference for the inclusion of transactions in blocks by paying high gas prices. The increase in gas prices also affects regular users who have to match arbitrageurs or risk having their transactions delayed.
Moreover, priority gas auctions (PGAs) involve traders/trading bots sending the same transaction multiple times, increasing the number of transactions gossiped through the peer-to-peer network. This affects node runners since they must invest in higher bandwidth to keep up with the message overhead.
3. MEV can impact security, permissionlessness, and decentralization in blockchains
If miners or validators start censoring transactions and capturing MEV opportunities, the decentralization of public blockchains could be threatened. MEV can also encourage the proliferation of “dark pools” which are permissioned mempools operated by block producers who share MEV profits directly with traders. Dark pools could destroy the permissionless nature of Ethereum and lead to centralization.
But, more importantly, MEV has implications for the security of blockchains.
An MEV-related security concern outlined in the Flashboys 2.0 paper is “time-bandit attacks” targeted at capturing MEV profits. Below is an illustration of this type of attack would work. We refer to block producers as miners for simplicity, but they could also be validators.
Bob and Charlie are two miners in Ethereum.
Bob mines block A which contains a transaction worth $5,000 in MEV profits and mines block B afterward.
Instead of building on Bob’s block, Charlie secretly re-mines block A and inserts a transaction capturing the MEV for himself.
Charlie also re-mines block B and mines an additional block C so that his chain is longer than Bob’s.
Charlie broadcasts the newly produced block to the rest of the network, causing a chain reorganization.
PoW blockchains follow the “longest chain rule”, (i.e. the chain with more blocks is considered the valid chain)
Charlie’s chain now replaces Bob’s chain
Bob’s earlier blocks simply “disappear”
Not only do time-bandit attacks threaten the notion of finality in blockchains, but they could lead to a breakdown in consensus. With multiple miners triggering chain reorgs, it’d be difficult for other nodes to detect the correct chain–as shown in the example, the “heaviest chain” rule isn’t always sufficient to determine a chain’s validity.
What are the benefits of MEV?
While MEV has negative connotations, it isn’t always harmful. For example, arbitrage traders ensure that users get the best prices for assets–especially on decentralized exchanges–whilst making profits themselves.
If a token is underpriced on a DEX, a large sell order will reduce its listed price; and if the token is overpriced, a large sell order will decrease its valuation. Without traders spotting price disparities across decentralized exchanges, the DeFi marketplace would lack efficiency.
What is MEV-Boost?
MEV-Boost is a solution created by the Flashbots team to help mitigate the centralizing forces of MEV designed in preparation for Ethereum’s switch to Proof-of-Stake consensus (i.e. The Merge).
Researchers hope that MEV-Boost and, in the future, Proposer-Builder Separation and danksharding will help to mitigate MEV’s real threats to a permissionless and decentralized Ethereum and will continue to further help reduce gas fees and network congestion for users.
Related overviews
What is Blockchain Sharding and How Does it Relate to Ethereum?
Explore a New Transaction Type that Guarantees Transactions are Mined and Optimized for Gas
Learn About Safe (Justified), Finalized, and Latest Commitment Levels