Blockchain technology is the driving force behind cryptocurrency, allowing transactions to take place between parties without the need for an intermediary. Depending on the blockchain and the consensus method used, cryptocurrency transactions can take anywhere from a few minutes to several hours to process.
In both proof-of-stake and proof-of-work consensus mechanisms, pending transactions are held in the network’s publicly visible waiting area called the "mempool," where they will sit until a miner or validator selects them, orders them and creates a block out of the information. That block is then validated by nodes in a network and added to the official chain.
But as a pending transaction sits in a mempool, miners and validators have found ways to profit from them by including, excluding or reordering transactions in a block. This strategy involves maximal (formerly miner) extractable value, or MEV.
MEV is a relatively new phenomenon, and research and development groups like Flashbots are working to mitigate the risks associated with it. According to the Ethereum Foundation, some methods of MEV extraction are malicious and result in a worse experience for the user, while other methods can help fix network inefficiencies.
While MEV is most commonly associated with Ethereum, because that is the second-largest blockchain, it’s important to note that it’s not an Ethereum-specific issue. MEV strategies are less lucrative on Bitcoin, the largest blockchain, because of its lack of smart contracts — a primary opportunity for MEV-extraction on Ethereum and similar blockchains.
What is MEV?
MEV is sometimes referred to as an “invisible tax” that miners can collect from users – essentially, the maximum value a miner can extract from moving around transactions when producing a block on a blockchain network.
The activity was first predicted in 2014 by an algorithmic trader under the pseudonym Pmcgoohan, who warned that miners could quietly rearrange transactions in a mempool for personal gain.
“Miners can see all the contract code they run (obviously) and the order in which transactions run is up to individual miners,” the trader wrote in a thread on Reddit. “What is to stop front running by a miner in any marketplace implementation by Ethereum?”
Smart contract researcher Phil Daian and his colleagues expanded on this idea in a 2019 paper titled “Flash Boys 2.0,” coining the term “miner extractable value” (MEV) to refer “to the total amount of ETH miners can extract from manipulation of transactions within a given time frame.” The phenomenon gained popularity after researchers Dan Robinson and Georgios Konstantopoulos published a blog post in August 2020, describing Ethereum’s mempool as a “dark forest” because of the fierce competition and shadowy methods used to capture MEV.
How does extracting MEV work?
There are different ways MEV can be extracted from block production on a network like Ethereum.
MEV was first used in the context of proof-of-work, where miners control the order and inclusion of transactions in a block. Thus, the original abbreviation stood for “miner extractable value.”
In theory, the Ethereum Foundation notes that network miners or validators should get the full MEV amount, because they are the only party that can guarantee a MEV extraction is successful. It notes, however, that a large portion of the MEV is retrieved by independent network participants called “searchers,” who run complex algorithms to detect profitable MEV opportunities and use bots to automate the process.
“Miners/validators do get a portion of the full MEV amount anyway because searchers are willing to pay high gas fees (which go to the miner/validator) in exchange for a higher likelihood of inclusion of their profitable transactions in a block,” the foundations explains.
Here are several examples of tactics used to extract MEV:
Front-running: Some searchers will use bots called “generalized front-runners” to scan the mempool for profitable transactions. Once a profitable opportunity is detected, the bot will replicate a user’s transaction with a higher gas price so that miners will choose that transaction over others.
Some groups are working to use this activity for good. Flashbots runs a service that allows Ethereum users and miners to communicate their preferred transaction order within a block. This is meant to be a “fair ecosystem for efficient MEV extraction” and has reduced the effectiveness of generalized front-runners, according to the Ethereum Foundation.
Sandwich attack: The term refers to a malicious type of front-running that is often used to manipulate cryptocurrency prices. It occurs when a searcher detects a large pending trade on a decentralized exchange (DEX) and places a trade right before and right after it to benefit from an artificial price change.
The sandwich attack will ultimately affect the amount of cryptocurrency the user who put in the initial transaction will receive, while the attacker will benefit from the price difference.
Seeing that there’s an order to buy $APE, the MEV bot places two orders: one transaction that pays extra gas fees to buy $APE before your transaction, and another transaction to sell $APE after your transaction.
- Transaction 1: MEV bot executes a buy order, pumping the token price.
- Transaction 2: MEV victim buys the token at the higher price.
- Transaction 3: MEV bot sells the token into the pool, benefitting from the price difference.
How high the MEV victim will end up paying depends on the “slippage” they’ve entered – the percentage price difference they’re willing to accept between the time of trade order and execution.
Dex arbitrage: Tokens will often have different prices on decentralized exchanges due to varying demand. When there’s a significant price difference across one exchange to another, MEV bots will buy lower-priced tokens to sell them on another exchange at a higher value. As a result, token prices across exchanges become more aligned, making the decentralized finance (DeFi) market more efficient.
This method is competitive but can be lucrative. In August 2020, a trader exploited a temporary difference between the price of stablecoins on several different decentralized exchanges, resulting in a net profit of $40,000:
Liquidation: DeFi lending protocols require users to deposit some cryptocurrency as collateral. When a user can’t repay his loans, the protocol typically allows anyone to liquidate the collateral and earn a liquidation fee from the borrower.
MEV searchers will compete to determine which borrowers can be liquidated and collect the liquidation fee for themselves.
Is MEV good or bad?
Using methods of MEV extraction like front-running and sandwich attacks can be harmful and result in network congestion and high gas prices for other users. But methods like DEX arbitrage can result in users getting the most fair prices across exchanges.
There are attempts to reduce the impact of malicious MEV, like Flashbots, and certain protocols search for the lowest prices for a trade across all exchanges and aggregators.
The leader in news and information on cryptocurrency, digital assets and the future of money, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups. As part of their compensation, certain CoinDesk employees, including editorial employees, may receive exposure to DCG equity in the form of stock appreciation rights, which vest over a multi-year period. CoinDesk journalists are not allowed to purchase stock outright in DCG.