What Is MEV In Crypto?
Including, examples of MEV attacks, how MEV bots make money, and more.
- Writer Andrew Cahill
- andEditor Shannon Ullman
- May 12, 2023
- •5 Min Read
The Milk Road Promise
We’re committed to helping you get smart about crypto. Some articles feature products from partners who compensate us, but opinions are always our own.
What Is MEV In Crypto?
Maximum Extractable Value (MEV) refers to the incremental revenue that blockchain validators can earn by including, excluding, or reordering transactions before finalizing them.
Similar to transaction fees, MEV is a cost borne by users that transact on public blockchains. Given that many users are not aware of MEV, it’s sometimes referred to as an “invisible tax.”
How Much MEV Has Been Extracted?
While the concept of MEV has been around since as early as 2014, it was not until 2020 that it really started being extracted.
As of May 2023, ~625K ETH of cumulative MEV has been extracted on Ethereum. At an ETH price of $1,850 that translates to ~$1.2B.
Approximately 70% (440K ETH) of this MEV was extracted before “The Merge,” which occurred in September 2022. The remaining 30% (180K ETH) has been extracted after “The Merge.”
On certain days, Ethereum validators and block builders have earned more ETH through MEV than they have earned in transaction fee revenue.
For example, on March 11th, 2023, ~5,100 ETH (~$9.4M at $1,850 per ETH) worth of MEV was extracted on Ethereum. That same day only ~2,600 ETH (~$4.8M at $1,850 ETH) in revenue was generated by transaction fees.
How Can Users Protect Themselves From MEV?
Let’s call a spade a spade. MEV is not good for users. But it is not all doom and gloom.
First off, users can protect themselves by using RPCS (e.g., Flashbots Protect RPC, MEV Blocker RPC), which will prevent trades from being front-run. For those familiar with the MetaMask wallet browser extension, setup is easy. Check out our article on how to use Flashbots for a full rundown.
Secondly, Ethereum users can claw back some of this MEV that is (potentially) being extracted from them by staking their ETH. With the advent of liquid staking solutions, such as Lido, users can stake any amount of ETH and earn staking rewards. The majority of validators (including Lido) run Flashbots MEV-Boost software and re-distribute the MEV they earn to stakers.
How Do MEV Bots Make Money?
MEV bots monitor the pending transaction queue to identify opportunities to generate MEV revenue. In instances where they successfully identify an opportunity, they are programmed to automatically submit transactions on behalf of their operators to capture MEV rewards.
What Is An Example Of MEV?
Top examples of MEV include sandwich attacks, decentralized exchange (DEX) arbitrage, and liquidation attacks:
- Sandwich attacks: A block builder or validator spots a large buy (or sell) order for one asset. They then place their own order ahead of the large buy order and capitalize on the price appreciation that this large order causes.
- DEX arbitrage: A blockchain user runs software (i.e., deploys bots) to identify price differentials between the same asset on different DEXes. Once the software identifies material price differentials, it buys an asset on one DEX and sells it on another at a higher price (typically all within one single transaction).
- Liquidations: Liquidations typically entail a transaction sender capitalizing on an oracle price update to be the first to liquidate a loan’s collateral to earn a profit.
As displayed in the chart below, sandwich attacks have emerged as one of the leading sources of MEV.
The Sandwich Attack
The average Ethereum user can’t see other users' pending transactions. But an Ethereum validator can. When it comes to MEV, this visibility is what allows validators to extract profit. They can spot large incoming buy (and sell) orders on DEXes and position themselves to profit at the expense of users.
The typical steps of a sandwich attack go something like this:
- Bob is an Ethereum validator (or block builder).
- In the mempool, he spots a trade submitted by Alice to make a large swap of USDC for ETH on the Uniswap DEX.
- Bob copies Alice’s trade and also submits an ETH buy order. But because Bob is a validator, he can place his buy order ahead of the order placed by Alice (who is not a validator and cannot see Bob’s transactions and cannot order transactions).
- Bob’s ETH buy gets filled first.
- Alice’s ETH buy then gets filled and pushes up the market price of ETH.
- Bob then sells his ETH at the higher market price and pockets the difference.
From the perspective of, Bob, that is a nice trade. Sure, there is a degree of risk involved with what he did - ETH’s price could have actually declined for a number of reasons and eliminated his profit opportunity. But if Alice’s order is sufficiently large, chances are that it will result in a price increase of ETH and a profitable trade for Bob.
From the perspective of Alice, this is clearly a suboptimal outcome. Bob’s initial ETH buy resulted in her trade being executed at a worse price. Had Bob not front-run her, she would have gotten more ETH in return for the same amount of USDC.
Bob’s subsequent sale could also put sell pressure on ETH and could have decreased its price. Had Alice wanted to sell her ETH after she bought it, she would have gotten less USDC in return, as Bob’s ETH sale pushed down the price of ETH.
If you are a Uniswap user and this is the first time you’re hearing about this, sorry. You could very well have been sandwich attacked without even knowing about it. But as mentioned above, the Flashbots Protect RPC is a good alternative that offers protection against these types of attacks.
Other Examples Of MEV Attacks
While the sandwich attack, DEX arbitrage, and liquidation attacks are the most prominent examples of MEV extraction, it can be extracted through a variety of methods. Some of these include:
- Back-running occurs when a validator places their transaction to be finalized directly after another transaction. Back-running typically occurs in conjunction with token listings on DEXEs. For example, immediately after someone begins providing liquidity for an asset on a DEX, MEV bots would buy large quantities of said asset. The bot would then wait for the price to go up and sell the tokens at a higher price.
- Front running, which is sometimes referred to as “sniping,” occurs when a validator detects a potentially profitable transaction(s) in the mempool. The validator then copies the user’s transaction and pays a higher fee for their transaction to be executed first - thus stealing the victim’s alpha and gains.
- Spam attacks, which are sometimes called “censorship attacks,” refer to instances where bots submit a large number of transactions to connect networks and prevent other users from being able to have their transactions confirmed.
- Time-bandit attacks are attacks where validators “rewrite” a blockchain’s transaction history to steal funds allocated by smart contracts in the past. If block rewards are small enough compared to MEV, it can be economically rational for validators to destabilize a network’s consensus process and attempt to reverse previously finalized transactions to extract MEV.
- Uncle-bandit attacks refer to attacks in which validators notice transactions in rejected blocks (uncles) that are not confirmed and selectively bring one or few of them back into the main blockchain to profit from them.
MEV And Network Congestion
Have you ever seen a chart of Ethereum transaction fees and wondered, “Why would anyone pay $30+ for a single Ethereum transaction?”
Sure, fear of missing out (FOMO) could be one cause of these high fees. When NFTs or meme coins are in a state of mania, one could (rightly or wrongly) justify paying $30, or even hundreds of dollars, to get their hands on them.
But knowing what we know about MEV, all signs point to MEV playing a big role in clogging up blockchain networks and increasing transaction fees for real users.
Take the “DEX Arbitrage” example from before. Consider a situation where ETH is trading on one DEX at $1,750 and on another DEX at $1,850. Even if an MEV bot needs to pay $99 in transaction fees to capture this $100 spread, it would still be rational for the bot to pay the fees. After all, one dollar of risk-free profits is still one dollar - even if it costs $99 to generate it.
On-chain data confirms this suspicion. One of the most notorious “sandwich attacker” MEV bots, jaredfromsubway.eth, has paid upwards of $30M in transaction fees to extract MEV on Ethereum.
What Are The Risks Of MEV?
While MEV has direct negative impacts on users, it also poses risks to blockchain network stability.
If the MEV available in a block significantly exceeds the standard block reward, validators may be incentivized to reorganize previously finalized blocks and capture the MEV for themselves. Blockchain re-organizations create network instability and could reduce users’ confidence in interacting with the network.
Additionally, MEV has the potential to emerge as a major cause of centralization. Identifying and extracting MEV requires significant technical expertise and resources. Solo-stakers who are running their own validators are less equipped to extract MEV and could be incentivized to delegate their stake to validators with more expertise - thus centralizing control over the network.
Finally, extracting MEV requires deploying new software, which could be subject to bugs and vulnerabilities. For example, ~90% of Ethereum blocks are currently sourced via the Flashbots MEV-Boost middleware. The system is dependent on a system of relays which could potentially go offline and cause network liveness failures.
Frequently Asked Questions
What Is Miner Extractable Value?Expand to learn more
Miner extractable value is synonymous with maximum extractable value. Following Ethereum’s merge, proof-of-work miners were replaced by proof-of-stake validators in Ethereum consensus. Hence, miner extractable value was deprecated as a term and replaced by maximum extractable value.
What Is Flashbots?Expand to learn more
Flashbots is a research and development organization aimed at making the MEV market more efficient, distributed, and democratic. It is a for-profit company that provides Ethereum software products to users and infrastructure providers in the MEV ecosystem.
Why Is MEV Bad?Expand to learn more
Certain types of MEV are bad because they increase the cost for real users to transact on blockchains. Extracting MEV can induce network congestion which increases the explicit costs for real users that want to transact on blockchains.
Does MEV Exist In Bitcoin?Expand to learn more
Yes, some MEV does exist on Bitcoin. Historically, Bitcoin was primarily used for simple transactions (e.g., transferring BTC from one address to another). But new innovations such as Ordinals and BRC-20 tokens are expanding the use cases of Bitcoin’s blockchain and creating new opportunities for MEV extraction.
Andrew Cahill Writer
Andrew previously was a Research Director at The Block; a crypto media and research company. Prior to that, he was a Research Analyst at Fundstrat; an investment research firm.
Shannon Ullman is the managing editor for Milk Road. She specializes in cryptocurrency and personal finance content. Her work has appeared in publications like Insider Inc.
Get smarter about crypto
Join 250,000+ subscribers and get our 5 min daily newsletter on what matters in crypto.