Foresight Ventures: Mapping, Categorizing, and Controlling MEV

Foresight Ventures
2022-07-27 14:29:35
Collection
The blockchain network has always been a dark forest with hidden currents, where robots compete for opportunities to extract potential profits in an unknown environment against unseen opponents.

Author: msfew, Foresight Ventures

0. MEV?

Maximal extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block.

a) MEV has always existed

The transaction ordering in Ethereum blocks has never been constrained by a fixed set of rules, but can be freely modified according to miners' preferences. The source code of the Geth client provides three examples:

  • First: Sort only by Nonce
  • Second: Sort by gas fee and Nonce (default option)
  • Third: Sort by owner, then by gas fee and Nonce

In fact, the sorting is completely open-ended; miners can adjust it freely to capture greater profits, which is the main focus of our discussion, MEV.

Before MEV was called MEV, its Alpha had already been continuously mined by miners. Flashfish0x shared a story about MEV.

Before August 2020, Compound's price feeds were updated by special oracle transactions, leading miners to monitor the Mempool for accounts that could be liquidated, using flash loans and other means for arbitrage. Since only arbitrage transactions executed immediately after the price update transaction could successfully profit, and ordinary miners (at that time) would randomly sort arbitrage transactions with the same gas fee, arbitrageurs would send transactions with the same gas fee as the oracle price update transaction, competing for a random chance.

After August 11, 2020, Geth released a new version where the first transaction to reach the network after the oracle price update transaction would successfully arbitrage, making the speed of obtaining transaction information a factor in the competition.

However, this good situation did not last long. On August 17, 2020, Compound switched to a more decentralized oracle. Thus, the competition among MEV capture participants turned into a pure gas war. They tried to bid higher gas prices than others until this liquidation operation could no longer capture any profits, or one person emerged victorious.

The blockchain network has always been a dark forest with hidden currents, where robots compete with unseen opponents for opportunities to extract potential profits.

b) MEV is everywhere

Before formally interpreting the definition of MEV, we can look at some data regarding MEV, which will give us an intuitive sense of its existence and impact.

image

In May 2022, over half of the trading volume on Uniswap was contributed by MEV bots, while less than 20% of the trading volume came from Uniswap's front-end interface.

image

Data from dex.guru also shows that a significant portion of the trading volume on Ethereum's AMM is contributed by MEV bots.

MEV bots are ubiquitous in the dark forest of blockchain and always hold a dominant position.

c) MEV supply chain

So how does an MEV activity come about?

image

The lifecycle of a transaction in the perilous blockchain is as follows:

  • Birth: Ordinary users interact with applications based on their intentions, wallets and applications interpret the intentions into transactions, sending them to public transaction pools and other systems waiting for processing.
  • Old: MEV seekers (which may be miners) pick out all profitable opportunities, attempting to capture MEV by sending transactions or deliberately ordering transactions.
  • Ill: L1 miners (most of the time not MEV seekers) or L2 Sequencers aggregate transactions and produce blocks.
  • Death: Validators (currently still miners) verify the block, and the transaction is officially confirmed.

MEV bots conduct on-chain activities according to the will of their owners, packaging transactions and sending them to unsuspecting miners for block production. From a positive perspective, they play an important role in ensuring market stability and DApp activity; from a negative perspective, they exploit "ordinary users" through their inherent advantages (being able to monitor the entire Mempool).

d) Specific definition of MEV

The term MEV has two official interpretations, and it can be fully defined as:

  • Miner Extractable Value
  • Maximum Extractable Value

When we combine the two interpretations, we arrive at the most easily understood concept: MEV is the maximum value that miners can extract, serving as an incentive for inserting transactions at specific positions within a block.

In my opinion, a more comprehensive definition of MEV refers to the maximum value that can be extracted by roles other than ordinary users, such as miners/validators/bots/oracles, utilizing the miners' asymmetric information. Roles other than ordinary users (who understand code, network mechanisms, and how to use MEV) can extract additional value through their "privileges," thus profiting, which can be considered a broad definition of MEV:

  • For example, a block-producing miner: After seeing transactions in the Mempool, when it's their turn to produce a block (which is a very small probability), they can completely reorder the transactions within the block according to their own wishes (instead of the normal nonce and gas fee sorting) and send new transactions, thus obtaining greater additional profits beyond the rewards.

image

  • For example, a user who understands how to use the MEV concept: Using Flashbots Protect as a transaction pool to avoid being exploited by MEV bots and gain advantages such as priority execution; monitoring the Mempool through flashside or the earlier mentioned Compound liquidation example to arbitrage NFTs and on-chain activities, using just the right gas fee to have unsuspecting miners help them capture MEV; monitoring the Mempool through mint.fun to mint the latest NFT projects.
  • For example, the most exploited ordinary user: Waking up in the morning to buy the dip on ETH, only to have the first transaction fail due to insufficient gas; finally succeeding with the second transaction at noon but getting exploited by a sandwich attack; staying up late at night to mint a free mint NFT they've had their eye on for a long time, but as soon as the transaction is sent out, it gets noticed by others, and they ultimately fail to mint.

The additional profits of MEV extractors come from other transactions within the block (which are almost all initiated by ordinary users) and occupy a portion of the space in each block (although gas fees lack elastic demand, their transactions are usually the first in the block and do not directly affect user transactions), thus most MEV is typically viewed as a hidden tax imposed on users.

1. Classification of MEV transactions

Here is a clear illustration of MEV activities by 0xminion:

image

In terms of purpose, MEV operations can be divided into: various arbitrage, pure front-running, sandwich attacks, etc.

Most of these operations will be arbitrage operations, primarily initiated by bots, which have done a lot of work to optimize gas. For example, they usually have countless tokens in their wallets, each with only a small amount. This mainly takes advantage of EIP-2200, where if a wallet has a token when a user receives an ERC-20 token, it saves more gas than if it didn't. Additionally, they ensure that addresses have more zeros. Of course, the above arbitrage optimization operations are not directly related to MEV itself.

MEV itself can mainly be divided into the following six types:

a) Front Running

Front Running is when MEV bots pay slightly higher gas fees to execute transactions ahead of a certain transaction in the Mempool, such as swapping tokens at a lower price.

image

When this type of MEV activity does not cause subsequent "casualties," it can be considered neutral (not positive because it mainly involves cutting in line); however, it often leads to subsequent transactions failing or executing poorly, thus being considered malicious.

Currently, many services focus on enhancing the capture of this type of MEV, such as bioXroute (similar to the mafia collecting protection fees and then providing a faster, more private Mempool, thereby accelerating transaction confirmation efficiency and defending against external front-running).

The core issue is that this type of MEV directly reflects the information asymmetry between MEV seekers and ordinary users. However, it is impossible for everyone to reach a consensus on a completely open, transparent, and unified method and algorithm for transaction ordering.

b) Back Running

Back Running is when bots attempt various arbitrages, liquidations, or transactions after a transaction causes a significant price misalignment.

The most typical example is the liquidation arbitrage operation we mentioned earlier; this type of MEV activity can be considered overall positive, ensuring market stability and continuous operation.

image

In networks with multi-chain architectures like Cosmos, this type of MEV activity is particularly effective because there are many networks that require such activities to ensure DeFi applications operate efficiently at all times.

c) Sandwich Attack

Sandwich Attack is a combination of the first two types of attacks, sandwiching a transaction from both sides. It is commonly referred to as a sandwich. For example, an MEV bot places a buy order before a transaction and a sell order after, causing the user's transaction to execute at a worse price.

image

This attack can sometimes be very complex and can cause significant harm; the following image shows a bot using 100 million DAI to sandwich a Curve user:

image

It can generally be considered malicious, but to some extent, it encourages users to use more reasonable slippage, thereby enhancing the overall benefits of the network.

d) Time-Bandit Attack

Time-bandit attacks occur after a block is generated, where miners re-mine the block, causing a blockchain reorganization while extracting value from the block they mined. This is the most malicious type of MEV, rendering user transactions invalid. Although it is extremely rare, it can happen.

image

In a blockchain network under Satoshi's consensus, due to the longest chain principle, block reorganizations occur very frequently (with significant delays), making it likely for this type of MEV to be captured. In Tendermint or PoS Ethereum, the occurrence of this type of MEV would be greatly reduced.

image

The cool aspect of time-bandit MEV is that future events can influence the past (including "future" transactions into "past" blocks).

However, in simple quantification, the expected return rate of such attacks is not high, and they would be condemned for deliberately undermining the stability of the blockchain network (such as Reorg-as-a-Service), so they rarely occur.

e) Clogging

The validity of any NFT, asset, and Rollup transaction is actually guaranteed by purchasing a certain space in a block on the blockchain network. Below is the supply and demand for blockchain block space:

image

Clogging is achieved by monopolizing all the space in a block continuously to win games like Fomo3D.

Do you remember the Geth source code mentioned at the beginning? Since about 70% of Ethereum miners sort transactions based on the default gas fee, Clogging occurs.

However, currently, due to the completeness of infrastructure, such as oracles and Rollups, transactions are submitted without hindrance. When MEV bots engage in such activities during active network periods, the costs can be relatively high.

f) Non-Broadcast Transactions

The initiators of the previous activities are mostly MEV bots, rather than the block-producing miners themselves.

Non-Broadcast Transactions are transactions secretly submitted by block-producing miners, meaning that when miners know they can produce a block, they instantly fill the block with some transactions to capture MEV.

image

Approximately 2% of transactions on Ethereum are generated in this manner.

2. Is MEV good or bad?

In the previous analysis, we explored different types of MEV, interspersed with our evaluations and judgments of each type's goodness or badness. So overall, is MEV good or bad? How should we respond to it? How will different networks respond to it in different ways?

The goodness or badness of MEV:

  • Good MEV: Used for arbitrage liquidation (Back Running), creating a transparent market (Flashbot, MEV Auction), without affecting the network or other users.
  • Bad MEV: Used to extract value from other users (Sandwich Attack), sent privately and not broadcast (Time-Bandit Attack, Non-Broadcast Transactions), affecting the normal operation of the network (Clogging).

From the quantity of classifications, MEV seems to be a neutral role that is neither good nor bad, but when considering the essence of MEV (the incentive to insert transactions into blocks), this incentive is too great, leading to the harm caused by chasing bad MEV far outweighing the benefits of good MEV. Furthermore, the emergence of MEV also stems from information and knowledge asymmetry; in the blockchain network, there is only equality, not equity.

In summary, the black market principle of MEV + huge profit incentives + complex situations and classifications = negative externalities in the blockchain network.

MEV is bad and needs to be reduced.

3. In-depth thinking and handling of MEV

Before discussing strategies for addressing MEV, we need to clarify one point: information asymmetry and externalities in any situation cannot be completely eliminated; we can only manage them better.

a) Addressing the MEV black market and its huge incentives

MEV is a black market created by opaque information and knowledge (or a dark forest), which generates enormous profits. We will consider strategies for MEV from this perspective.

The global black market is estimated to be worth about $180 billion and is an inevitable evil that cannot be eliminated. The MEV market is also much larger than we can observe.

image

Since this black market is inevitably present, why not let it be exposed to the sunlight, allowing everyone to freely capture and protect their own MEV? This way, ordinary users can form a collective force and weaken the resistance of MEV seekers against users.

Flashbots proposed the following five market solutions to limit the extraction of MEV, thereby reducing the overall negative externalities of MEV:

image

These MEV reduction solutions are similar, but they share the same drawback of potentially leading to wasted block space and centralization of block production.

b) MEV complex situations: scenario differences

  • Single-chain scenario: Most of this article discusses the MEV situation within a single blockchain network, which is overly idealized in reality.
  • Cross-chain scenario: One blockchain network = one trust zone. In practice, there are countless blockchain networks with different mechanisms and types of MEV, and these countless trust zones create arbitrage opportunities across networks. For example, even if Ethereum has no MEV, if there are arbitrage opportunities on Cosmos, then bridge validators or cross-chain application bots can capture MEV on Cosmos, ultimately making Ethereum a victim of this MEV.

image

  • Multi-chain scenario: Examples from the cross-chain scenario can seamlessly apply to the multi-chain architectures of Cosmos or Polkadot, where the existence of MEV is contagious.

c) MEV complex situations: network architecture differences

In our exploration of Rollup networks, we learned about the differences between standalone Layer 1 and Layer 2 Rollups built on top of it.

1. Rollup

As an "enhanced smart contract" and "centralized trusted blockchain network," Rollups currently have centralized block production and ordering mechanisms, leading to different MEV manifestations. Currently, centralized Sequencers (which consist of only one node) allow all MEV to be captured by Rollups. As more liquidity and on-chain activities shift to L2, the income (including MEV) that L1 miners can obtain is actually transferred to L2 Sequencers.

Of course, Rollup networks are also aware of and addressing this issue; their fair sorting of transactions reflects their handling of MEV. Different Rollups have different strategies for MEV, which means different implications for network participants:

image

As L2 moves towards decentralization and the implementation of modular blockchains becomes more prevalent, the issue of MEV will require more research and thought. For example, the modular landscape of Ethereum and Celestia will differ. Currently, all Rollups on Ethereum are Secured Rollups, which only need to build n bidirectional trusted cross-chain bridges (which are their primary function) to settle collectively on Ethereum, while the Sovereign Rollups encouraged by Celestia govern themselves, and their DA may vary, potentially requiring n^2 bridges or protocols similar to IBC or XCM to fully connect. This establishes entirely different MEV markets and capture opportunities.

From the issue of L2 MEV, we can also derive thoughts on the value relationship between L1 and L2, which will not be further elaborated in this article.

image

2. More centralized blockchains

To achieve faster speeds, Solana does not have a public Mempool; instead, it uses a Gulf Stream that only miners expected to produce blocks can see as its Mempool (which is also the reason for its downtime…). This means that MEV bots cannot capture MEV; only running a Validator and miners about to produce blocks theoretically have the opportunity to order transactions or send new transactions to capture MEV. However, combined with the low miner profits in Solana, this design actually leads to even lower miner income. Therefore, Jito Labs has created a client similar to Flashbot's mev-geth to allow miners to auction their block space, creating a public free market for MEV. Solana also has solutions like QUIC and per account fee markets.

Conclusion

Regarding the topic of MEV, this article is merely a surface-level analysis, and many interesting aspects have not been mentioned due to space constraints (SGX, PBS, etc.). I recommend you delve into the more than 50 related links at the end.

In an ideal network:

  • Anyone can send transactions (no censorship)
  • No spam (no spam)
  • Very low fees (low fees)

image

Yet the existence of MEV makes it impossible to have both fish and bear's paw:

  • no spam + low fees: Censorship similar to Web2 must exist.
  • no censorship + low fees: MEV Searchers will send spam, affecting normal transactions.
  • no censorship + no spam: You need a fee market to order transactions, which requires high gas to prioritize transaction execution.

However, there is no need to worry too much; Web1, Web2, or the real world have not completely resolved the negative externalities of "MEV," and various solutions in Web3 are already doing very well. MEV has always been an open question with no completely correct answer.

So what should we do in Web3?

  • L1/L2: Prioritize MEV in design.
  • Miners: Confidently capture value without harming the ecosystem, as this is part of network game theory.
  • DApp developers: Consider MEV when designing applications and whether the mechanisms will harm ordinary users.
  • Users: Understand MEV and try not to use networks or applications with poorly designed MEV mechanisms.
  • Others: Encourage research on MEV and participate in discussions about MEV, Front run the crisis.

Links:

https://thedailyape.notion.site/MEV-8713cb4c2df24f8483a02135d657a221

0a:

https://ethereum.stackexchange.com/questions/6107/what-is-the-default-ordering-of-transactions-during-mining

https://github.com/ethereum/go-ethereum/blob/290e851f57f5d27a1d5f0f7ad784c836e017c337/miner/worker.go

https://twitter.com/flashfish0x/status/1516378083628093447

0b:

https://twitter.com/sui414/status/1532088483296120832

0c:

https://twitter.com/thegostep/status/1521104235114508289

0d:

https://docs.flashbots.net/flashbots-protect/rpc/quick-start/

https://twitter.com/blockworksres/status/1532782392569606145

https://twitter.com/_anishagnihotri/status/1520579207478267905

http://mint.fun

https://www.recvc.com/mev-2-0-the-rise-of-mpsvs/

https://twitter.com/hasufl/status/1439938607142277121

1:

https://rileygmi.substack.com/p/what-is-mev-a-simple-guide

https://twitter.com/0xminion/status/1418059536712167432

https://twitter.com/libevm/status/1474870665773682692

https://medium.com/coinmonks/on-efficient-ethereum-addresses-3fef0596e263

1a:

https://rekt.news/return-to-the-dark-forest/

https://medium.com/offchainlabs/five-theses-about-transaction-ordering-mev-and-front-running-5ebf52bc0cbe

1b:

https://twitter.com/thyborg_/status/1547898785933639684

1c:

https://twitter.com/bertcmiller/status/1527757146716348416

https://twitter.com/tarunchitra/status/1549134678036303873

1e:

https://www.longhash.com/en/news/2280/With-Just-20-Billion-Ethereum-Network](https://www.longhash.com/en/news/2280/With-Just-$

https://twitter.com/Leorzhang/status/1374383287309758476

1d:

https://www.paradigm.xyz/2021/07/ethereum-reorgs-after-the-merge

https://www.paradigm.xyz/2022/07/consensus-throughput

https://twitter.com/0x9116/status/1413687410941169666

https://femboy.capital/mev-time-turner

https://twitter.com/SiegeRhino2/status/1416311471303188481

1f:

https://medium.com/blockchannel/life-cycle-of-an-ethereum-transaction-e5c66bae0f6e

2:

https://docs.google.com/presentation/d/13qcmaznKdAElherLI6fsBexJILYwTj2ddQlMTGUipU/edit#slide=id.g10d8f1642560_0

2a:

https://twitter.com/mohakagr/status/1417143241812561930

https://docs.google.com/presentation/d/13qcmaznKdAElherLI6fsBexJILYwTj2ddQlMTGUipU/edit#slide=id.g45d315b027c424f113

2b:

https://pdaian.com/blog/mev-wat-do/

3a:

https://twitter.com/mohakagr/status/1417143241812561930

https://docs.google.com/presentation/d/13qcmaznKdAElherLI6fsBexJILYwTj2ddQlMTGUipU/edit#slide=id.g45d315b027c424f113

3b:

https://mp.weixin.qq.com/s/GT4Yfw8VPhBikME4mKCTNQ

https://twitter.com/j0hnwang/status/1489268470973878272

https://ethresear.ch/t/mev-auction-auctioning-transaction-ordering-rights-as-a-solution-to-miner-extractable-value/6788

https://ethresear.ch/t/mev-resistant-zk-rollups-with-practical-vde-pvde/12677

https://twitter.com/j0hnwang/status/1489268486358671364

https://www.youtube.com/watch?v=lLuHFFbYv0Y\&t=10s

https://twitter.com/benjaminsimon97/status/1380291321286569986

https://twitter.com/apriori0x/status/1546464783318372353

https://twitter.com/0xmisaka/status/1511370043501785091

https://twitter.com/jon_charb/status/1546501633856634880

https://twitter.com/sreeramkannan/status/1550572765899472896

https://twitter.com/barnabemonnot/status/1550346797494800384

4:

https://twitter.com/bertcmiller/status/1399737488151830538

https://notes.ethereum.org/@vbuterin/pbscensorshipresistance

https://twitter.com/0xmisaka/status/1511370037306834954

https://pdaian.com/blog/mev-wat-do/

https://medium.com/flashbots/frontrunning-the-mev-crisis-40629a613752

Not Included but Recommended to Read:

https://twitter.com/0xElan/status/1547026528235429894

https://twitter.com/uriklarman/status/1546971147018948609

https://twitter.com/Thyborg_/status/1547898785933639684

https://twitter.com/0xcacti/status/1548470752071913472

https://twitter.com/sxysun1/status/1483860078331584512

https://theknower.substack.com/p/its-all-a-dark-forest

https://flashbots.mirror.xyz/NayGRPko-vFnauN5WOn6rQHgMEUqCpmlPPDfKRXJriU

https://learnblockchain.cn/article/3163

https://ethereum.org/en/developers/docs/mev/

Related tags
ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators