Introduction To MEV

IntermediateJan 04, 2024
This article provides a comprehensive analysis of MEV (Miner Extractable Value), discussing its origins, its impact on various blockchain networks, and the strategies adopted by different participants in the blockchain ecosystem to leverage or mitigate MEV.
Introduction To MEV

Introduction

Blockchain technology, while revolutionary, also comes with nuances that pose a challenge to the system and ecosystem of its respective space.In a blockchain, miners and validators act as security proponents to confirm transactions and secure the chain. This means that they are also independent parties that are able to reorder transactions in a given block for their benefit.

Maximum Extractable Value (also known as miner extractable value), or MEV for short, refers to the maximum amount of profit that a block producer can earn through arranging, adding, or removing transactions within the blocks they produce. Their returns are primarily derived from unilaterally excluding, including, or reordering transactions within blocks. Despite its name, it doesn’t solely apply to Proof-of-work (PoW) chains, but also validators on Proof-of-Stake (PoS) chains as well. This paper aims to provide a comprehensive analysis of MEV, exploring its origins, its impact on various blockchain networks, and the strategies employed by different actors within the blockchain ecosystem to exploit or mitigate MEV.

History and Theory

History

The first recorded case of MEV emerged in 2014 on the Ethereum blockchain, discovered by an analyst coder. He was extremely interested and hopeful in the technology until he realized a fatal flaw in the system — the autonomous nature of validators and miners enabled them to extract value from unsuspecting users.

In 2019, a group of researchers from Chainlink Labs published a paper called “Flash Boys 2.0” that highlighted that MEV isn’t a theoretical practice, rather it was already a functionality that was being directly exploited on a plethora of widely adopted protocols.

Theory

The blockchain is initially designed to be secured by a decentralized network of machines, which are called block producers. These block producers include validators and miners who assume the role of confirming transactions on the immutable distributed ledger system. They aggregate pending transactions into a block which are then validated by the network then included in the global system.

Although there are measures in place to prove that all transactions are valid and not double-counted, there is no way to ensure that they will be arranged in the same order as they were posted on the chain. TThis is why, when block producers select transactions from the mempool, which is the blockchain’s queue of pending transactions, they are able to prioritize transactions with the highest fees before submission.

Infrastructure for MEV

Technical Infrastructure for MEV

In the present MEV ecosystem, there are third-party bots and parties that manipulate transaction fees in order to ensure that their transactions are prioritized in block submission. This can be considered disadvantageous to the typical user who may not have the necessary funds, resources, nor technical expertise to utilize this phenomenon.

On the block producer end, there are also third parties involved, consisting of searchers, builders, and relayers. Searchers essentially “search” a mempool of pending transactions for potential MEV profit opportunities. They bundle these transactions, which are then sent to builders who “build” full blocks and send them to relayers. The relayers, trusted aggregators of proposed blocks, validate them and pass the most profitable one to the validator for submission.

Common Attacks

MEV attacks are strategies used by miners, validators, or traders to exploit their ability to reorder, include, or exclude transactions within a block to maximize their profits, as previously mentioned. Here are some common types of MEV attacks:

Front-Running

This is when a participant observes a profitable transaction waiting in the mempool and quickly creates a similar transaction with a higher gas price. This encourages miners to include their transaction first, allowing them to benefit from the price movement caused by the original transaction.

Example: Alice wants to buy a toy, but Bob pays a small bribe to prioritize his transaction and buys the toy instead.

Back-Running

This is similar to front-running, but instead of placing a transaction before the targeted one, the attacker places their transaction immediately after the targeted one. This is often used in scenarios where the attacker intends to benefit from the price movement caused by the original transaction.

Example: Alice plans to bid on a painting at an auction. Bob waits for Alice to bid, then quickly sells his identical painting to the crowd at Alice’s high bid price.

Sandwich Attacks

In this type of attack, an attacker places a transaction both before and after a targeted transaction. This can manipulate the price of a token in a way that allows the attacker to buy low and sell high, essentially “sandwiching” the targeted transaction.

Example: Alice plans to buy a toy. Bob buys it first, raising the price. Alice buys at this high price, then Bob sells his toy at this inflated price, effectively sandwiching Alice’s purchase.

Arbitrage

These attacks take advantage of price discrepancies between different decentralized exchanges (DEXs). An attacker can simultaneously buy a token at a lower price on one DEX and sell it at a higher price on another.

Example: Bob sees apples are cheaper in another town. He buys there and sells them in his town at a higher price.

Time-Bandit Attacks

In a Proof-of-Work network, a miner conducts what’s known as a chain reorganization in order to manipulate previously confirmed blocks. The purpose of this is to extract MEV from transactions that have already been included in those blocks. This is not only a more complex form of MEV attack but also potentially more disruptive, as it requires altering the existing blockchain structure.

Example: Bob, a miner, sees Alice has found a gold vein. He uses his power to turn back time, reach the vein before Alice, and takes the gold for himself.

Case Studies on MEV

General Sentiment and Statistics

The MEV landscape in 2023 is a dynamic and multifaceted field, reflecting a blend of opportunities, challenges, and innovations. The past year has seen significant activity in the MEV space, with bots generating revenue of at least $307 million on Ethereum. Arbitrage opportunities, accounting for over 47.5% of total revenue, have been the most frequent, while sandwich and liquidation opportunities have also played substantial roles.

Within this context, the week of 08/06/2023 statistics provide a snapshot of the ongoing trends. Arbitrage attempts extracted $8.48 million, sandwich attacks accounted for $559,000, and liquidation attacks were less prevalent at $14,000. These figures are part of a broader pattern that emphasizes the complexity and dynamism of the MEV ecosystem.

The total MEV volume involving sandwich bots in 2022 was an impressive $287 billion, with Uniswap V3 being a hotspot for both arbitrage and sandwich bots. Interestingly, the MEV opportunities on Binance Smart Chain (BSC) were found to be more cost-effective than on Ethereum, indicating a more welcoming environment on BSC.

The frequency and nature of MEV opportunities have shown variations, depending on market conditions. While arbitrage opportunities were the most frequent, liquidation opportunities were more dependent on intense market fluctuations. The revenue generated by different MEV types also exhibited monthly variations, with certain months showing significantly higher revenue due to specific market events.

The landscape also revealed an oligopoly pattern in MEV, with the top 2 block builder addresses capturing over half of MEV after the Ethereum Merge, though builders pass most MEV to proposers in the last transaction in the block. The competitive environment of MEV bots and the distribution of profits among different types of bots further illustrate the intricacies of the market.

The insights gained from analyzing specific statistics, comparative analysis between different blockchain platforms, and understanding the broader trends provide a comprehensive view of this evolving field. These insights contribute to a deeper understanding of the MEV ecosystem, reflecting its multifaceted nature and implications for the future of decentralized finance. The continuous exploration of liquidity data, the development of new market-making strategies, and the efforts to address the fairness and regulation of the MEV market are critical in navigating this dynamic environment.

MEV Exploit

On April 3, 2023, at Ethereum block height 16,964,664, a group of MEV bots were exploited for $25.3 million. An analysis of the exploit revealed that a renegade validator switched the MEV bots’ transactions and seized various crypto tokens.

The exploit was a sophisticated operation that involved a rogue Ethereum validator and a group of MEV bots. The rogue validator, identified as “Sandwich the Ripper,” prepared assets across multiple tokens and baited the targeted group of MEV bots to try to front-run his transaction on low liquidity V2 Uniswap pools. This was done over an 18-day operation.

In a typical sandwich attack, an MEV bot reads an incoming transaction and front-runs the order, pushing up the price of the asset for the original buyer. The buyer then pushes the price up even further by buying the same assets as originally intended. The MEV bot then sells the asset immediately after the original buyer’s transaction goes through, making arbitrage profit off the buyer.

However, in this case, the rogue validator baited the MEV bots with an exploited transaction, forcing the bots to spend their WETH to arbitrage the baited assets inside a low liquidity pool while the exploiter needed not make an actual purchase transaction. The exploiter then modified the transaction order within the same block and sold all of its tokens (that it had prepared before the attack) immediately after the MEV bot had bought the baited assets. The exploiter then sold his tokens at a higher price to drain all of the WETH from the low liquidity pool, leaving the MEV bot with worthless tokens that it had acquired in the process.

The rogue validator managed to drain five MEV bots using the same strategy over 24 transactions. The stolen tokens were then distributed into three separate wallets, holding $20 million, $2.3 million, and $2.9 million, respectively.

In response to the exploit, the Flashbot community has rolled out a patch to all relays to prevent future attacks like these from happening again. While some have reported the attack as ‘malicious,’ others in the crypto community argue that the attack on the MEV bot was part of the game and that no foul play was involved.

Defi Summer

However, while MEV is often associated with challenges and negative impacts, it has also played a beneficial role in certain contexts. For example, during the DeFi summer of 2021, MEV usage was correlated to faster transactions and lower gas fees on Ethereum.

Figure: Gas Prices on Ethereum vs. MEV-geth bundles via Flashbots

The adoption of MEV-extraction software like Flashbots’ Mev-geth has surged, with over 78% of Ethereum miners now using it to package sequenced transaction bundles and capture MEV profits. This is enabled by features like miner bribes and bundle rejection without gas costs. As shown in the graph above, the proliferation of MEV bundling appears to correlate with lower average gas fees on Ethereum, as MEV software mitigates issues like Priority Gas Auctions (PGAs), where bots drive up fees through transaction fee wars.

In the case of sandwich attacks, a form of MEV that will be explored in the next section, miners or validators include certain transactions within a block while discarding others. By prioritizing transactions in this way, they can facilitate quicker execution and reduce the overall cost for users. This selective inclusion allows the network to handle a higher volume of transactions, contributing to the efficiency and effectiveness of the system during periods of high demand.

Overall, MEV-focused software has gained dominance in Ethereum as it aligns miner and trader incentives via transaction ordering techniques that may also inadvertently reduce network congestion and costs.

MEV Adjacent Products

Flashbots

Companies like Flashbots help create rebalance in the ecosystem by researching and developing protocols that attempt to mitigate negative externalities posed by MEV. They’ve built an ecosystem in which bots submit bundles of transactions directly to miners instead of the public Ethereum pool and miners then receive bids without others seeing it, and get to include those bundles in the blocks they mine.

Protocols such as MEV-Boost, created by Flashbots, provide a way for validators to access relayed blocks through a marketplace of builders who want to buy their blockspace. By using MEV Boost, validators can opt to include these specially crafted blocks that may have higher profitability due to the rearranged transactions. This allows validators to potentially earn more from the MEV opportunities that the builders have identified and packaged into the relayed blocks. They can also add relayers from Flashbots, Bloxroute, Blocknative, Eden, or Manifold, to name a few.

Fastlane

Fastlane is another infrastructure company that attempts to rebalance security concerns posed by MEV. Fastlane is a protocol designed to reward participating validators for protecting the health of the Polygon blockchain.

Fastlane offers a unique solution that allows validators to generate revenue from various actors in the blockchain ecosystem, including arbitrageurs, liquidators, and NFT traders. Through a competitive auction process, algorithmic searchers bid for access to Fastlane during designated periods known as “sprints.” Winning bidders gain an enhanced likelihood of successful trades without the need for a direct connection to the validator node, and, importantly, without knowledge of the validator’s peer ID, enode address, or IP address.

This approach significantly bolsters the security and privacy of validator nodes, leading to healthier nodes by reducing the economic incentive for bots to flood the node with redundant transactions. Fastlane’s design does not facilitate harmful practices such as front-running transactions and “sandwich” attacks. Instead, it prioritizes the overall health of the Polygon blockchain. Furthermore, by eliminating randomness from the transaction propagation dynamic, Fastlane could potentially lower data costs for sentry nodes, further contributing to the efficiency and robustness of the network.

Cow Protocol

There are also applications with specific use cases or software that leverage MEV for various purposes, such as Cow Protocol. Cow Protocol matches trades peer-to-peer where possible, eliminating the need for a middleman and saving users money. This is referred to as a Coincidence of Wants (CoW). They search all exchanges and aggregators to ensure users get the best price available, eliminating the need for users to compare prices on different platforms. They also protect users from front-running and sandwich attacks, which can result in significant losses for traders. It achieves this by matching trades peer-to-peer and leveraging batch auctions, making the order of trades irrelevant.

If a price moves in the user’s favor after an order is placed, Cow Protocol gives the user the price at the time of execution. It collects orders into “batches” every 30 seconds. This is done off-chain, which has several benefits, including no charges for failed trades and fees collected in the sell token, not ETH. Cow Protocol’s solvers compete to find the best liquidity source for your trade across all decentralized exchanges and aggregators. They submit the batches on-chain and hide them from the public mempool, protecting trades from manipulation (front-running and other forms of MEV) by miners and bots.

Kolibrio

Lastly, Kolibrio attempts to revolutionize the MEV space by being among the first protocols to offer Broadcaster Extractable Value (BEV) relay. This technology ensures transaction broadcasters, such as node providers, DeFi wallets, bridges, and other dApps, can own the order flow they create and be able to monetize it. This is possible when transactions are automatically searched for MEV opportunities before entering the mempool. When there is an MEV opportunity in a transaction, the BEV will relay that information to searchers, upon which the searchers will bid on the transaction for the user to claim.

By holding transactions at the Broadcaster level and introducing an auction mechanism for MEV, it democratizes MEV extraction, reducing the chances of exploitation through transaction ordering or front-running. The system’s validation and wait mechanisms act as buffers against malicious MEV strategies, while the aggregation of transactions ensures efficient processing that’s harder to manipulate. Furthermore, by automatically directing MEV profits to broadcasters, the system not only ensures equitable distribution but also incentivizes entities to prioritize user interests, fostering a more secure and user-centric blockchain ecosystem.

MEV Outside of Ethereum

Solana

MEV can be achieved through various strategies, including frontrunning, backrunning, and sandwich attacks. However, when we transition from the context of Ethereum to Solana, the landscape of MEV undergoes significant changes due to the fundamental architectural differences between the two blockchains.

In Solana’s PoS system, validators, who are staked with a substantial number of tokens, are responsible for finalizing transactions. This system is further enhanced by Solana’s unique feature of validator clustering. Validators are grouped into clusters, and they rotate in taking the role of the leader validator. The leader’s role is confined to determining the order of transactions for voting, not their finality, thereby adding an additional layer of security against potential malicious actors.

Another key difference between Solana and Ethereum lies in the existence of a mempool. While Ethereum’s mempool is a crucial component for many MEV strategies, Solana does not possess a mempool. This means that independent network participants, often referred to as “searchers,” are unable to target individual transactions unless they are acting as a validator. Additionally, Solana recently introduced a priority fee along with a fixed fee, so searchers can get their transactions included faster.

Despite these architectural differences, Solana is not entirely immune to MEV. A prevalent form of MEV activity on Solana is Decentralized Exchange (DEX) arbitrage. In this scenario, traders exploit price discrepancies between different DEXs. For instance, a trader might identify a difference in the SOL/USDC exchange rate between Raydium and Orca, two DEXs on Solana, and execute a profitable arbitrage trade.

Interestingly, sandwich attacks, a common MEV strategy on Ethereum, were not observed on Solana. This is likely attributable to Solana’s lack of a mempool and the fact that only the leader validator has access to transactions before they are finalized.

In the realm of Non-Fungible Tokens (NFTs), MEV has manifested in the form of NFT bots. These bots inundate popular NFT launches with mint requests, aiming to secure as many tokens as possible for immediate resale. This not only disrupts the NFT market but also leads to network congestion. To combat this issue, Solana has proposed solutions such as adjusting the transaction gas fee to increase the cost of spam requests and imposing a “tax” on invalid transactions.

Additionally, a company called Jito Labs offers a suite of specialized products that could significantly impact the MEV landscape in Solana. Here’s how:

  1. Enhanced Validator Performance and Revenue Jito-Solana Client:

By providing an open-source validator client, Jito Labs helps validators on Solana better utilize their hardware and earn more revenue. This can lead to more competitive validation, thus reducing potential MEV extraction from transaction ordering. Jito Block Engine: This engine assists in building the most profitable and efficient blocks for validators. By optimizing block construction, it can reduce opportunities for transaction reordering, a common MEV strategy, making the network more resilient against certain MEV attacks.

  1. Outsourced Spam Mitigation and Signature Verification Jito Relayer:

This tool allows validators to outsource spam mitigation and signature verification, which can reduce congestion and lead to more efficient block creation. This might lower the potential for malicious actors to exploit MEV through spam attacks.

  1. Sequential Execution and Enhanced Trading Capabilities Jito Bundles:

By allowing for the sequential execution of transactions, Jito Labs adds an extra layer of control over transaction ordering. This could mitigate some MEV strategies like front-running and sandwich attacks. Jito Mempool: Traders can leverage the Jito Mempool to get access to higher transaction delivery guarantees. This ensures more reliable transaction execution, reducing the potential for MEV extraction through transaction reordering or exclusion. ShredStream: This feature allows traders to save significant time by receiving shreds directly from leaders. By enhancing the efficiency of trading, it could reduce the window of opportunity for MEV attacks, such as arbitrage exploitation.

Jito Labs’ offerings present a multifaceted approach to enhancing Solana’s blockchain. By focusing on optimizing validator performance, ensuring efficient block construction, mitigating spam, and enhancing trading capabilities, Jito Labs contributes to a more secure and resilient network.

These innovations could reduce the susceptibility of Solana’s blockchain to common MEV strategies, fostering a more equitable and transparent transaction environment. While it may not eliminate MEV entirely, the integration of Jito Labs’ products with Solana represents a proactive step toward mitigating some of the negative impacts associated with MEV.

In the rapidly evolving blockchain space, such technological advancements by Jito Labs provide valuable insights into how MEV challenges can be addressed, not only within Solana but potentially across other blockchain networks as well.

In conclusion, while the nature and manifestation of MEV on Solana significantly differ from that on Ethereum due to architectural differences, MEV remains a prevalent issue. The Solana community continues to explore and implement solutions to mitigate the impact of MEV on its network, ensuring the integrity and efficiency of its blockchain operations.

Layer 2 & Cross-chain

MEV on Layer 2 (L2) extends from the original MEV on Ethereum Layer 1 (L1). However, within the context of EVM chains, the potential for participants to manipulate the order, inclusion, or censorship of transactions is not significantly different between L1 and L2. Both layers share the fundamental MEV concept, with MEV primarily arising from the ability of miners (or validators in a Proof-of-Stake system) to reorder, include, or censor transactions within the blocks they produce.

This ability can be used to exploit arbitrage opportunities, front-run transactions, or extract rents from users. However, the introduction of Ethereum 2.0 and the increasing use of L2 solutions for scalability are subtly shifting the MEV landscape.

One specific distinction in the MEV landscape arises in the case of certain chains like Avalanche (AVAX), which do not share mempool data except with validators. This unique behavior can alter the dynamics of MEV, as fewer entities have access to transaction data, potentially affecting the scope for transaction manipulation and value extraction.

However, the L2 environment also presents opportunities for innovative solutions to the MEV problem. For instance, the concept of Proposer-Builder Separation (PBS) can be applied in L2 solutions, where the roles of proposing a block and building a block are separated, potentially mitigating some MEV-related issues.

Moreover, the exploration of cross-chain MEV, which involves MEV extraction across different blockchain networks, is also a significant part of the L2 MEV landscape. This is a new dimension that doesn’t exist in the L1 context, and it opens up a whole new field of research and potential strategies for MEV extraction and mitigation.

In conclusion, while L2 MEV shares the fundamental concept with L1 MEV, the unique architectural and operational characteristics of L2 solutions introduce new dimensions to the problem. The ongoing research and development in this area are crucial for ensuring the robustness, fairness, and decentralization of Ethereum and other blockchain networks as they scale.

Proposer-Builder Separation

What is Proposer-Builder Separation

Proposer-Builder Separation (PBS) is a proposed solution to the challenges of censorship and MEV attacks in blockchain networks. The concept of PBS is rooted in the idea of separating the roles of block construction and block proposal within the network. This separation of duties is designed to create a more decentralized and secure network while also addressing the issues of MEV.

Before Proposer-Builder Separation

In blockchain networks, specialized participants called validators are critical to operations like transaction processing and block creation. In early blockchain protocols like Ethereum, validators were assigned two key duties — block building and block proposing. The same validators would gather pending transactions, determine block contents, order transactions, and fully construct new blocks. These same entities would then broadcast the finished blocks they created as proposals to the rest of the network for validation and inclusion in the blockchain.

This consolidation of responsibilities was problematic, as it granted validators excessive control over which transactions were included in blocks and in what sequence. Validators could leverage this influence to engage in strategies that generated extra profits for themselves. For example, they could order transactions in ways that enabled the extraction of maximal fees from users looking to prioritize their transactions. Validators could also exploit their position to engage in market manipulation, including or excluding specific transactions to influence token prices to their advantage. These practices fall under the concept of Maximal Extractable Value, where validators maximize profits by optimizing transaction ordering and censorship.

Larger, well-resourced validators were naturally best positioned to fine-tune blocks and engage in these MEV strategies. This led to centralization risks, as smaller validators struggled to compete in extracting maximum value from transactions. Overall, consolidating the duties of building and proposing blocks into one validator entity created vulnerabilities around fairness, security, and decentralization.

After PBS: Mitigating MEV and Enhancing Blockchain Security

To resolve these issues, innovations like Proposer-Builder Separation (PBS) were introduced. PBS formally decomposed the two validator responsibilities, block building and block proposing, into separate roles handled by distinct node types.

Under PBS, block building is handled by specialized builder nodes. Their sole function is to construct block contents in an optimized way that maximizes value for the overall network, without favoring any single entity. Transaction sequencing, inclusion, and order are determined using algorithms designed to limit opportunities for manipulation. These finished block bundles are then passed along to dedicated proposer nodes.

The proposer nodes have one simple role — to take the completed blocks from the builders and propose them to the rest of the validator network for approval and inclusion in the blockchain. Importantly, proposers do not participate in block creation under PBS. This prevents them from applying preferential transaction ordering or other self-serving changes to the blocks, as they only see the contents once construction is complete.

By formally decomposing these two duties into separate, specialized roles, PBS limits the power any single node has over the end-to-end transaction process. This, in turn, enhances decentralization, security, and fairness across networks like Ethereum. PBS represents an important evolution in how blockchain networks are architected and governed.

Conclusion and Future Directions:

The future of MEV presents a complex landscape, shaped by the rise of DeFi and the evolution of blockchain technology. While MEV can generate substantial profits for certain actors within the blockchain ecosystem, it also poses challenges, including potential negative impacts on transaction originators and risks of validator centralization.

The Ethereum community is actively exploring strategies to mitigate these challenges while preserving the beneficial aspects of MEV. These strategies, including MEV burning, MEV smoothing, and MEV sharing, each present unique benefits and trade-offs, and their successful implementation will require careful consideration and significant resources.

The introduction of the Ethereum Merge and the concept of PBS has added further complexity to the MEV landscape. The widespread adoption of MEV-Boost has led to increased block rewards, but also the potential risk of validator centralization.

In conclusion, the management of MEV is a critical issue for the future of Ethereum and other blockchain networks. As these technologies continue to evolve, so too will the strategies for managing MEV. Future research should continue to explore these strategies, as well as the emergence of new forms of MEV and their impact on various blockchain networks. The ongoing exploration and development in this area are crucial for ensuring the robustness, fairness, and decentralization of these networks as they continue to scale.

Disclaimer:

  1. This article is reprinted from [Delta Blockchain Fund]. All copyrights belong to the original author [Delta Blockchain Fund]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!
Create Account