insight_page.researchinsight_page.xangle_originals

Feb 01, 2023

MEV (Maximal Extractable Value): The Greatest Challenge for Blockchain to Overcome

user-image
Jaewon Kim
Xangle

Translated by Rhea 

MEV (Maximal Extractable Value): The Greatest Challenge for Blockchain to Overcome

 

Table of Contents

1. Introduction: Why Crypto Users Need to Learn about MEV 

2. What Is MEV (Maximal Extractable Value)?

3. How MEV Impacts the Blockchain Ecosystem

4. Will Ethereum's Switch to PoS Affect MEV? 

5. Conclusion: Different Blockchains' Measures against MEV and Future Challenges 

 

 

1. Introduction: Why Crypto Users Need to Learn about MEV

1-1. The Omnipresent Predators Preying on Your Money

Yes, it’s a jungle out there. Ethereum is swarming with predators called “MEV bots.” Whenever there is an opportunity to make a few bucks by taking advantage of any loopholes in the market, you can bet that MEV bots will immediately pounce on it. Dan Robinson and Samczsun, partner and researcher at Paradigm told the stories of their gruesome fight against MEV bots for a hefty sum in their gory details in "Ethereum is a Dark Forest" and "Escaping the Dark Forest" respectively. Reading these articles will go a long way for our readers in understanding MEV. Though invisible, MEV certainly does exist. We need to arm ourselves with knowledge about them to fight them off. 

MEV bot exploits, Stolen by MEV bots, Etherscan
Funds Stolen by MEV Bots; Source: Etherscan

1-2. Better the Tax You Know 

MEV is often called the “invisible tax” in the crypto world. Users need to be made aware of this tax that they are paying without even realizing it. In particular, when the amount of transaction is large, the loss incurred by MEV can be massive, making it all the more critical for individual and institutional investors with a large sum of operating funds to identify the risks related to MEV.

 

2. What Is MEV (Maximal Extractable Value)?

2-1. Definition 

Maximal extractable value (MEV) refers to the total sum of economic gains block producers obtain while they arbitrarily include, exclude, and assign orders of transactions. MEV was originally used to refer to “miner extractable value.” However, as various types of consensus algorithms come into play, the term naturally changed to a more comprehensive meaning: “maximal extractable value.” The concept of MEV first appeared in a report by Philip Daian et al., "Flash Boys 2.0."

2-2. Mechanism 

Before taking a stab at understanding MEV, we need to learn about the process of how blocks are produced in blockchains. Many people are misinformed and misunderstand transactions in blockchains to be recorded in a first-come, first-served manner. In fact, it is quite the opposite. Blockchains are more like auction houses, selling blockspace to the highest bidder. 

Blockchain networks have computer nodes called block producers, such as miners (PoW), validators (PoS), and sequencers (L2). Their role is to gather transactions submitted by the users and generate blocks. Since only a finite number of transactions can be included in each block, when the demand gets high, the block producers will opt to select the transactions with the highest gas fee first among all the pending transactions sitting in the mempool* to maximize their profitability. The added profit that the block producers obtain from users by using their ability to include, exclude, and reorder the transactions arbitrarily is what we call MEV. In other words, MEV exists mainly because i) blockspace is limited (30M gas maximum for Ethereum), ii) all the activities on the blockchain are transparently open to the public, iii) there is a fee market, and iv) block producers can decide on the ordering of transactions at will. 

Block production process, mempool, transaction ordering

*Mempool, short for “Memory Pool,” refers to an off-chain storage where transactions not yet recorded on the blockchain are standing by. You can check out the status of the Ethereum public mempool at this link.

2-3. Illustrative Case  

Let us assume that the slippage from a large transaction on Uniswap left open a USD 1,000 arbitrage opportunity. If User A, who was lucky enough to spot this opportunity, submits a transaction that can realize arbitrage profit with a USD 10 gas fee to the validator node, one of the following two scenarios may unfold (with a close to 0% chance for User A to get that arbitrage profit, unfortunately). 

  1. A block producer copies User A’s transaction and excludes the transaction submitted by User A from the block, taking the arbitrage profit for themselves. 
  2. Other arbitrage bots also notice this transaction and submit the same. At this time, bots continuously raise their gas fee whenever they are making the submission to make sure their transactions are the ones approved. The crypto industry refers to such an auction-like phenomenon as a PGA (Priority Gas Auction). 

 

In this example, that USD 1,000 is the MEV. If the block producer does not take MEV for themselves, a PGA will start where the total MEV after paying the gas fee becomes the potential profit for the auction winner (the arbitrage bot), and the gas fee becomes the profit for the block producer (as presented in the figure below.) 

Bot PGA, Priority Gas Auction, gas bid
Source: Flash Boys 2.0: Frontrunning, Transaction Reordering, and Consensus Instability in Decentralized Exchanges

In fact, PGA is how most of MEV is secured today, with block producers not very often ending up extracting MEV themselves. However, some rare cases have been spotted where block producers collude with MEV bots to divvy up the profit or sell access to private mempools. We expect to see more block producers participating in the MEV competition as the level of network activity grows.

2-4. Types of MEV Attacks 

The Uniswap arbitrage explained earlier is one of the typical front-running examples. Types of MEV attacks include:

  • Front-Running: It refers to stealing the opportunity for highly profitable transactions (e.g., arbitrage) observed in the mempool by producing the exact same transaction but with higher gas fee.
  • Back-Running: It refers to generating a profit by placing an order immediately after the target transaction is made, which is the opposite of what front-runners do. The most representative example of back-running is an MEV bot putting in an opposite order immediately after a temporarily high slippage is incurred due to a large-scale transaction and profiting from the arbitrage trading.
backrunning, how backrunning works, MEV bots
  • Sandwich Attack: It is an MEV attack that executes front-running and back-running at the same time, taking profit before and after the target transaction when successful. Just like front-running and back-running, such attacks often take place on AMM DEXs like Uniswap.
    • Example: An MEV bot that spotted a large order to purchase Altcoin A on Uniswap would immediately create an identical transaction to front-run the user making the order. Then, when the user who made the original order purchases Altcoin A at a higher price, the bot would immediately sell the token it purchased, profiting from the arbitrage.
sandwich attack, how sandwich attacks work, mempool, MEV transaction
  • Liquidation: MEV bots may monitor lending protocols like MakerDAO and Aave in real-time for an opportunity to liquidate a user’s position to profit off of the liquidation fee.

 

3. How MEV Impacts the Blockchain Ecosystem

MEV bots continue to search through mempool like a predator preying on its game even as we speak, and getting even more advanced and sophisticated as time goes by. The views on MEV vary widely even within the industry. MEV does make positive contributions to the blockchain industry such as stabilizing token market price through arbitrage trading, making quick liquidation that enables guaranteeing loan collection for the creditors and securing market soundness. However, given the scale of damage we witness today, the bad incurred by adversary MEV activities far outweigh the few good mentioned above.

3-1. User Experience (UX) Damaged and Profit Stolen

Malicious MEV activities such as front-running or sandwich attacks that frequently take place seriously damages the experience for the users. As explained earlier, as long as there are MEV bots, there is a close to 0% chance for amateur traders to realize profit from the arbitrage opportunities they spotted fairly. Users’ funds are often exploited as in the case depicted in “Ethereum is a Dark Forest” mentioned earlier. According to MEV-Explore, the total extracted MEV since January 2020 is around USD 675 million (with the actual MEV estimated to be multiple folds greater) as of October 29, 2022.

Source: MEV-Explore v1

3-2. Network Overload

The excessive competition brought on by PGA causes network overload and gas fee inflation. The average gas fee had skyrocketed to 474 gwei at the time of Yuga Labs’ Otherdeed sale on last May 1, and miners and bots had extracted USD 44 million MEV on the day the Chinese government announced a ban on using crypto assets May 19, 2021.

Source: MEV-Explore v1

3-3. Network Instability

Malicious MEV activities may seriously threaten the network security and cause a risk of centralization. A representative example is the time bandit attacks. It is when MEV attackers re-execute blockchain history to steal profit, destroying network stability and trust. This type of attack can take place when the block rewards are considerably smaller than the MEV profit. These attackers are likely to prey on smaller blockchains whose security is more vulnerable.

  • Example: Block Producer A has produced two blocks. The rewards for making the blocks are USD 500 per block, and one of these blocks contained a USD 10,000 arbitrage transaction on Uniswap. At this time, Block Producer B has a choice between two options: either i) take the block the Block Producer A made and build their own new block on top of it, or ii) re-organize the two blocks Block Producer A already built to take the profit from arbitrage and continue on with the new blockchain. After the re-org, the chain B created becomes the longest chain and B successfully steals the USD 10,000.

The possibility of time bandit attacks in Bitcoins was explored in depth in the “On the Instability of Bitcoin Without the Block Reward” issued in 2016. The paper discusses how a few powerful miners will have more and more incentive to opt for time bandit attack as we face Bitcoin halving over and over again and the block rewards keep on decreasing.

Sidenote: Censorship Resistance Undermined

On the other hand, concerns are rising about censorship resistance – one of the unique features of blockchains – since the MEV solution most widely used in the blockchain industry, Flashbots, is complying with the regulations set by the Office of Foreign Assets Control (OFAC, under the U.S. Department of Treasury). Currently, 64% of total blocks are OFAC-compliant, which is not a small figure at all. Transactions censored by Flashbots include tornado cash.

Source: mevwatch.info

4. Will Ethereum’s Switch to PoS Affect MEV?

In its most basic sense, MEV is connected to transaction ordering. In this aspect, Ethereum’s switch to PoS poses an indirect impact on MEV since it changes the way validators are selected and the validators hold the power to decide the order of transactions. In the PoW consensus algorithm, miners are selected randomly, and no one can be aa 100% sure who will be the next miner. However, after Ethereum switches over to PoS, and someone is selected to be a block producer, it is possible to identify who will be the fellow validators for the duration of two epochs. This translates into a real possibility for the validators to collude in trying various MEV extracting strategies such as oracle manipulation across various blocks.

Moreover, the switch to PoS reduces ETH rewards for block production by close to 90%, inadvertently encouraging validator nodes to go for MEV activities. If the daily mining reward were around 13,000 ETH in the PoW scheme, the daily block production reward in the PoS scheme would be a mere 1,600 ETH. On top of that, the base fees are burned since EIP-1559, further reducing the validator nodes’ take. Such mechanism greatly reduces the inflation, contributing toward maintaining and raising the value of ETH, which also means the reward for block production is significantly cut down. Such a situation leaves too much room for validators to be more aggressive in their MEV activities in order to compensate for the reduced rewards.

Source: ultrasound.money

 

5. Closing Thoughts: Different Blockchains’ Measures against MEV and Future Challenges

Truth be told, it is next to impossible to fully solve the issue of MEV due to how the blockchain is structured. In fact, it may even worsen as the technology advances with time. Fortunately, blockchains and other MEV solutions are fully aware of this as well, and are continuously working on research and development for ways to minimize the MEV damages or for fair distribution of profits. Let us conclude this article with introduction of some of the well-known examples.

5-1. Ethereum: When Life Gives You Lemons, Decentralize It with PBS (Proposer-Builder Separation)

The way MEV is structured today ensures that it is monopolized by a few and powerful validators equipped with advanced hardware that can update mempool in a lightning speed and abundant resources to develop sophisticated MEV extraction algorithms. Ethereum’s Proposer-Builder Separation (PBS) design was devised as a solution to decentralize MEV. In a nutshell, it seeks to include even the nodes with lower computing power and less resources in the MEV distribution by splitting the roles of block producers into block proposers and block builders. Builders here refers to validators with powerful MEV extraction capabilities who would handle transaction ordering and block production while proposers refer to validators with the authority to select which of the blocks the builders submitted would be recorded on the chain. In other words, it takes apart the transaction construction and block production which used to be handled solely by a validator, enabling that validator to take the entire MEV. With PBS applied, however strong a validator is (a builder), they are forced to divide up the MEV with a weaker validator (a proposer). Proposers take the bid price and builders take the MEV after the transaction fee and the bid price as their profit. One important thing to point out is that the builders would only disclose the block header and the desired bid during the bidding process, not the entire block data. (If the entire block data were to be disclosed, other builders could just copy and paste the whole transaction and steal the MEV.) The rest of the block data would be disclosed after proposers select the block. PBS is scheduled to be adopted along with the introduction of Danksharding.

5-2. MEV Boost, Front-running as a Service (FaaS)

In order to understand MEV Boost, we first need to learn about the Flashbots Auction developed by the Flashbots team.

Flashbots Auction

Flashbots Auction is a service developed to minimize the negative elements of MEV mentioned earlier, characterized by operating i) a separate and private transaction pool rather than a regular mempool where transactions are broadcasted to all, and ii) as a sealed bid blockspace auction based on one of the traditional auction methods, "First Price Sealed Bid Auction." Flashbots Auction participants are comprised of searchers, relays and miners. Let us explore each of their roles and how the Flashbots Auction is carried out.

  • Searcher: Searchers capture MEV opportunities and form the optimal blocks to extract them. MEV bots and a few general users who want to be protected against MEV attacks by submitting their transactions sealed fall into this category. Searchers send transactions with MEV opportunities to private transaction pools with the bid price. Since all the data sent are sealed, searchers cannot check the content and bid price of each other’s transactions. Only the relays and miners have access to such data.
Source: Flashbots
  • Relay: Relays act as the mediator in the auction, validating transactions submitted by the searchers and selecting the most profitable blocks to relay their headers to the miners. Once the miner selects a block header, the entire block is sent to the miner. Relay’s transaction validation process includes filtering spam transactions, which is to prevent searchers recklessly sending massive amount of transactions with gas fee exempt from using private transaction pools or potential for DDoS attack. (Bid price replaces the gas fee.)
  • Miner: Miners build the block with the highest bid price by getting the blocks from the relays. Miners’ profits are incurred from the searchers’ block bid prices, and searchers profits are the total MEV after the bid price. Miners need to use an Ethereum client called MEV-Geth to access Flashbots’ private transaction pools.

Two benefits can be expected when using the Flashbots Auction: i) MEV’s fair value can be measured by the market through sealed-bid auction, and ii) PGA can be prevented as searchers are not able to check  each other’s bid prices.

MEV-Boost

MEV-Boost is essentially the same service as the Flashbots Auction, but with a new added player group called builders between the searchers and the relays. MEV-Boost builders serve an almost identical role as builders in the Ethereum PBS: They gather transactions from searchers to form blocks with the highest expected MEV profit and send them to relays. Then, relays validate the blocks sent by the builders, the same as in the Flashbots Auction, and relay them to the block producers. At this time, block producers can only get the blocks produced by the builders if they have connected MEV-Boost software to the consensus client. According to Flashbots, validators can increase their staking rewards by up to 60% when using the MEV-Boost. Currently, Flashbots’ activity is very high with a whopping 81% of Ethereum relay blocks produced by Flashbots, causing some concerns about centralization.

how mev-boost works, searcher, relay, mev-boost, validator
Source: Flashbots
top relays, flashbots, BloXroute, eden, blocknative

5-3. Cosmos: Let Us Tokenize MEV

According to ATOM 2.0 white paper published at the end of last September, Cosmos plans to tokenize MEV via the Interchain Scheduler and boost blockspace auction activities. Using interchain MEV is more important to Cosmos network than any other L1 blockchains since it needs a way to stabilize asset prices through arbitrage because Cosmos has a large number of app chains, and fragmented assets (with asset prices varying by chain). When tokens are on different chains like they are on Cosmos, there is no guarantee that you would successfully profit from arbitrage even if you captured the opportunity. On Ethereum, you would be able to easily pass arbitrage transactions in a single block as a flash loan, but on Cosmos, even if the transactions pass through one chain, other transactions needed to conclude the arbitrage may not pass other chains. (For example, even if you successfully purchased Token Z at USD 0.9 on Chain A, if you fail to sell Token Z at USD 1.1 on Chain B, the arbitrage fails.)

To cope with such issue, Cosmos has come up with an idea to tokenize blockspace (as NFTs) to be sold in auctions in a separate consumer chain called the Interchain Scheduler. The launch of Interchain Scheduler enabled Cosmos protocols to send blockspace tokens to the consumer chain and purchasers to bid for blockspace with their $ATOM to finalize their arbitrage opportunities. A part of the revenue incurred from token sales would go to the protocols selling the blockspace, with the rest going to the Cosmos Hub treasury, organically linking up with the Interchain Allocator.

 

 

<Disclaimer>

This content was produced independently by the author(s) and does not necessarily reflect the opinions of CrossAngle Pte. Ltd. The content is meant for informational purposes only. It is not meant to serve as investment advice. You should conduct your own research, and consult an independent financial, tax, or legal advisor before making any investment decisions. Past performance of any asset is not indicative of future results. Please see our Terms of Service for more information.