MEV (Maximal Extractable Value) is one of the most misunderstood concepts in web3. While it may seem simple at first, there are layers of complexity underlying how it works, the actors that are involved, and how to classify the different varieties.
While MEV (or the concept of arbitrage) isn’t new, it has a high level of visibility and, therefore, scrutiny as it relates to blockchain networks. The opportunity for MEV is significant and growing. Data shared by Flashbots estimates earnings from MEV in Ethereum, which is where most MEV occurs, to be close to $1 billion and growing.
In this blog, we’ll outline how MEV works at a fundamental level, the different types of MEV that are most common, and what the future holds for this economic phenomenon.
MEV is present in every ordered system
MEV stands for Maximal Extracted Value. It refers to the value derived from controlling transaction inclusion and ordering. We find MEV in blockchain due to the necessity for transactions to be ordered and included into a block prior to commitment on-chain.
There was a time in the Ethereum ecosystem when MEV stood for "Miner Extracted Value", but with The Merge and the subsequent replacement of Miners with other economic actors called Validators and Builders, the switch from "Miner" to "Maximal" was made.
While MEV is a popular topic of conversation within web3 ecosystems, it is not a phenomenon unique to blockchains. Every ordered system has some form of extracted value. Consider the following ordered systems:
- Airplane seat selection: Pay a premium, get preferential seating. On a full flight, individuals may have to pay $50-100 to get out of the middle seat.
- Search engines: Search engine optimization enables practitioners to ensure a web page ranks higher on a search engine results page, which results in more traffic.
- Concert ticketing: Seats at concerts have limited quantities and when they go on sale, people can buy up tickets in bulk (front run you) and resell them to you at higher prices.
- Air traffic control: Different airlines have different agreements with different airports to get priority to runways, particularly at peak traffic times.
- Harbor traffic: Ships that have agreements with port facilities get priority; other ships wait at anchor or literally drift at sea outside shipping lanes.
- Equities markets: A security can be purchased in one market and simultaneously sold in another market, for a margin. The temporary price difference of the same asset between the two markets creates arbitrage opportunities for traders.
- And, of course, blockchain networks: MEV occurs when a trader can arbitrage sandwiches, front-runs, back-runs, or liquidations in a way that creates profits.
MEV and extracting value in web3
While most web3 users may not know it, there is a high likelihood that they have contributed to MEV. If you have ever interacted with a decentralized exchange or DeFi protocol on any blockchain, you have likely experienced slippage.
This will usually only be noticeable to you on the back-end of the transaction when you realize that you didn’t get quite as much in return for your swap as you were expecting (i.e. you experienced a high amount of slippage).
We’ll cover the technical details of how these approaches work later in this blog. For now, what you should know is this:
- Due to the transparent nature of the mempool, all transactions are constantly being monitored.
- When network actors specializing in MEV see transactions that hold the potential for value extraction, it’s not a question of if MEV will happen, it’s only a question of who will capture the value.
- Almost every transaction that exchanges tokens with independent values holds the potential for MEV.
Much MEV is benign and, in fact, necessary for free markets to achieve equilibrium and the proper functioning of decentralized financial systems. At worst, it can lead to incentives for transaction delays and censorship while also needlessly congesting the network and raising gas fees for normal users.
Transaction Ordering Impacts MEV
MEV is possible due to the process of transaction ordering. Originally, the acronym “MEV” stood for “Miner Extractable Value” because it referenced value that only cryptocurrency miners could extract. This was due to the power they had to order transactions in a specific manner within the blockchain “blocks” they processed.
Traditional (naive) transaction ordering
The graphic below shows traditional transaction ordering based on gas fees. On the left side, you have transactions in the mempool; the gas icons tell you how much gas is included in each transaction. On the right, you see a proposed block stack-ranked, with the highest gas prices at the top and the lowest fees at the bottom of the block.
MEV occurs when searchers intercede naive transaction ordering and change the order of inclusion by gassing up their transactions.
Extracting value through alternative transaction ordering
MEV is about creating profit opportunities through transaction reordering. Below is an example of an arbitrage opportunity in which a target transaction (in green) moves the price of a given asset on a given DEX. MEV is created when a response transaction (in red) takes advantage of the price differential on different DEXs. In order to realize the margin, the block must be ordered with the arbitrage transaction following the target transaction.
In the diagram, you’ll see the arbitrage transaction (red) immediately follows the target transaction (green), thus successfully extracting the arbitrage opportunity by buying low index a and then selling high index B. This is generally viewed as “benign” MEV because the target transaction isn't harmed and the arbitrage helps establish price parity across various exchanges.
As DeFi opportunities on Ethereum and other chains arose, so did the opportunities for these types of transactions. In 2018, the Ethereum blockchain mainly processed transactions sending tokens between different addresses with no opportunity for MEV extraction.
On-chain economics changed drastically in 2020. An explosion of DeFi protocols created the landscape we see today where interactions with smart contract protocols are responsible for the vast majority of transactions:
Gas consumption tells many stories, from the rise of DEXs to the rotation of capital from DeFi to NFTs.— CASΞY (@caseykcaruso) August 10, 2022
I coded up a viz to explore the top gas guzzlers on Ethereum with data from @nansen_ai.
Some insights below but even better, see what you can find!https://t.co/V5mohw6PIS pic.twitter.com/CWKuj6amVJ
The increasing complexity of value transfers created a new frontier of MEV opportunities. Whereas miners originally were the actors taking advantage of these opportunities, the industry for MEV became so lucrative that other specialists called “searchers” started to emerge and began honing their skills in monitoring the mempool to profit from MEV opportunities. These early searchers now explore the boundaries of complex MEV with multi-token, multi-DEX, and even cross-chain MEV.
Several early searchers eventually coalesced into a collective known as Flashbots that organized a system for searchers to bid for miners to include specific transactions.
Under Proof-of-Work, the Ethereum MEV system functioned as follows:
- Users and smart contracts generated economic activity on-chain in the form of transactions
- Searchers monitored these transactions for MEV opportunities
- They bundled these opportunities and submitted bids for miners to include their bundles within blocks
- Miners monitored bids and chose the most lucrative opportunities
Since The Merge, the way MEV is processed on Ethereum has changed slightly:
- Economic activity creates opportunities
- Sophisticated actors still monitor and then create transactions bundles that capitalize on those opportunities
- With the elimination of miners, block builders are now incentivized to include searcher bundles so they can create more profitable blocks, increasing their chance of having the winning bid for block proposers (validators)
There are a variety of types of MEV related to transaction ordering. Some MEV has little to no impact on the way the target's transaction settles. Other forms of MEV are considered more extractive as it relates to the outcome for the user. We cover these forms of MEV in depth below. If you’re interested in tracking these types of activities, check out zeromev to watch MEV unfold live and see how the MEV impacts the settlement of the targeted transactions.
The Different Types of MEV
Arbitrage in the world of web3 is the same as in traditional finance and is a natural mechanism for markets to achieve equilibrium. Investopedia describes traditional arbitrage as:
“(T)he simultaneous purchase and sale of the same asset in different markets to profit from tiny differences in the asset's listed price.”
However, whereas arbitrage in the real world is usually possible due to differences in physical realities (the price of a widget is 20% higher in Country A than Country B), arbitrage in web3 is made possible by the value of assets within different web3 ecosystems.
Consider a situation where the price of Ethereum is $2000 on Uniswap, but at the same time, it is $1990 on Sushiswap. An arbitrager can take advantage of this gap by buying ETH on Sushi to resell on Uniswap, instantly pocketing $10 per ETH (minus gas fees).
Arbitrage is non-extractive MEV because arbitrage has to exist within an economic system with free-floating prices. Therefore, actors that take advantage of arbitrage are not harming other users and are instead simply reacting to naturally occurring price fluctuations. Normal arbitrage is a healthy and necessary part of maintaining price stability within DeFi ecosystems.
While arbitrage is considered neutral MEV by default, if there are arbitrage opportunities only made possible by front-running, it is considered malicious to the end-user whose transaction created the MEV opportunity. The MEV searcher will reorder transactions on a certain liquidity pair before backrunning and/or censoring the target until after their backrun. This creates an arbitrage opportunity that is artificially created before being exploited.
Standing for “Just in Time” Arbitrage, JIT arbitrage occurs when a searcher sees a large swap in the mempool and then sandwiches the trade with liquidity in the underlying pool. In practice, this can look like approving DAI, depositing liquidity, swapping a large amount, and then removing the liquidity afterward.
There is a class of MEV focused on taking advantage of oracle updates and rebases. The idea is to sandwich transactions around an oracle update or rebase to take advantage of this new EVM state.
With an increasing number of chains including different versions of the same asset (i.e. “wrapped” ETH on Avalanche or Solana) and the increasing popularity of L2 assets (ETH on Arbitrum and Optimism), cross-chain arbitrage is a field of MEV that will likely only expand in the future.
Liquidations are another type of MEV that anyone versed in traditional finance will find familiar. A liquidation occurs when the collateral used for a loan by a borrower no longer covers the value of their debt.
In the world of web3, these liquidations occur automatically at the smart contract level and any participant in the ecosystem can repay the debt and claim liquidated collateral.
Consider a situation where a user takes out a loan for 5 ETH of DAI from AAVE. At the time of the loan, ETH is worth $2,000. This puts the loan value at $10,000 of DAI.
They deposit 10 ETH as their collateral for this loan. The loan is set so that the liquidation threshold is 80%. This means that, If at any point, due to fluctuations in the price of ETH, the value of the loan rises above 80% of the collateral, the AAVE smart contract will trigger a liquidation event.
In this scenario, a drop of ETH to $1,240 would liquidate their loan because the $10,000 loan would be equal to 80.5% of the $12,400 of collateral. This “over-collateralization” of loans provides a safety cushion for lenders in the event of extremely rapid price fluctuations.
Once a loan is liquidated, any user on the Ethereum network has the opportunity to purchase the original collateral ETH at a discount. When combined with arbitrage, this allows a liquidator to quickly make a profit by buying and reselling the asset via a market with a higher price. This form of MEV is neutral because liquidations are a natural occurrence within any financial system that allows for buying and lending.
While liquidations are generally neutral, they can also be malicious. This occurs when a trader is attempting to re-collateralize their loan to avoid liquidation, but the transaction attempting to add funds is censored so the liquidation is still triggered (and the attacker can buy the original collateral at a discount).
Front-running is the process of inserting transactions before a subsequent transaction with the sole intent of making a profit from the subsequent transaction. Front-running is popular because it generates more lucrative arbitrage opportunities than would have otherwise been possible.
This is a concept that is well-known in traditional finance. Investopedia describes front-running as “trading stock or any other financial asset by a broker who has inside knowledge of a future transaction that is about to affect its price substantially”. In traditional financial markets, front-running is usually considered to be illegal behavior. This is what leads to its classification in DeFi as malicious.
Sandwiching is a form of web3 market manipulation prevalent within DeFi ecosystems. It occurs when a searcher attempts to profit from an asset's price volatility. The searcher will jump ahead of the target's large purchase order, which raises the price. They will then place a sell order following the confirmation of the victim's order.
The diagram below outlines the basic process for sandwiching. The searcher identifies a transaction that will raise or lower the price of an asset. They then insert their transaction before the original to “front-run” the price change, allow the original transaction to execute at the new price, then complete a final transaction with the funds from their first transaction to capture the difference in price they knew would occur.
Pool imbalance sandwiching
This is an alternate type of sandwiching. The searcher swaps the relative sizes of distributed exchange liquidity pools during the front-run and resets them in the back-run. This type of MEV can sometimes result in the sandwiched transaction receiving almost nothing in return for their swap.
Censorship in MEV is the process of manipulating blocks to exclude specific transactions for a number of blocks. This is done, for example, to maintain an arbitrage opportunity or make a specific NFT purchase before another user. Sometimes censorship efforts will delay transactions for so long that they fail. This is especially harmful because it causes the sender to lose the gas fees spent on the transaction.
NFT sniping occurs when searchers utilize front-running or censoring to monitor and outbid transactions for specific sales of NFTs.
Ethereum’s Roadmap for MEV
Post-Merge, all eyes in the Ethereum ecosystem have been on MEV. A new category was even added to the official Ethereum roadmap that specifically covers developments related to MEV. It is known as "The Scourge":
Can confirm. Scourge was elevated to a full category in response to community feedback that getting MEV/anti-censorship right is really really important, for example.— vitalik.eth (@VitalikButerin) November 5, 2022
The official Scourge diagram makes it clear that the most important development for the future of MEV will be the completion of in-protocol Proposer/Builder Separation (PBS). It also introduces new potential considerations for how network actors will complete MEV on-chain in the future and what features this will unlock. Opportunities for distributed block builders, pre-confirmations, and in-protocol frontrunning protection are all exciting potential goals.
Despite upgrades related to MEV being prioritized by Ethereum's development team, the realistic timeline for full implementation of in-protocol PBS is likely at least 12 months. In the meantime, proto-PBS via MEV-Boost and a variety of relays will continue to allow validators to reap the rewards of transaction ordering.
MEV & Blocknative
MEV searchers can use Blocknative’s suite of tools to search with an edge and securely get MEV bundles on-chain by submitting to our RPC endpoint
https://api.blocknative.com/v1/auction. You can learn more by visiting our MEV bundle RPC endpoint docs. Create a free Mempool Explorer account today and begin prototyping your strategies.
Validators can earn more by connecting MEV-Boost to the Blocknative Relay endpoint. Connect to our relay today to maximize your block rewards.
If you’re a dapp or wallet interested in #ShareTheMEV, we would love to chat with you.
You can always join our Discord community for direct access to Blocknative employees. Or follow us on Twitter @Blocknative for the latest updates from our team.
Master the Mempool today.
Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.Start for free