Intro to MEV
MEV (Maximal Extractable Value) is a concept that has gained a lot of attention in the cryptocurrency world lately. As blockchain technology has evolved, it has become clear that the order of transactions matters significantly, and the order can be manipulated to extract value from the system.
MEV refers to the total value that miners or validators can extract from a blockchain beyond their normal fees. MEV is created by the order in which transactions are included in a block. When a transaction is included in a block, it can interact with other transactions in ways that produce additional value. This additional value can be captured by miners or validators who re-order transactions in a way that maximizes the MEV. This has led to the emergence of companies like Flashbots, a Pantera portfolio company, which are attempting to address this issue.
Example
Let’s take a look at a hypothetical scenario to break down MEV in the context of crypto.
Suppose you’re a trader on a decentralized exchange, looking to buy a particular token at a specific price point. You place your order and wait for it to be executed by the blockchain network. However, what you may not realize is that your transaction is now part of a complex web of transactions and actions that are happening simultaneously.
In the meantime, a miner on the network has access to all the pending transactions and can potentially manipulate them to their advantage. For example, the miner could choose to prioritize certain transactions over others, including their own, to earn more profits. This is known as MEV or Miner Extractable Value.
In your case, if your order is placed after another transaction that has a higher fee attached to it, the miner may choose to execute that transaction first, resulting in your order not being filled at your desired price. This can result in a loss for you as a trader, while the miner earns more profits.
Overall, while MEV is an issue in the crypto space, there are solutions being developed to mitigate its impact and provide a more equitable and secure environment for traders and users.
Most common MEV attacks
Here are the most common attacks you should be aware of and how they work.
Front-Running
Front-running is when a malicious actor places their transaction ahead of a known pending transaction in the execution queue. This is typically done by using specialized front-running bots that scan the network for large orders on decentralized exchanges. The bots then submit competing transactions with higher gas fees to get them mined before the victim’s transaction, which allows them to gain a financial advantage.
Sandwich Attacks
A sandwich attack is a type of front-running where the attacker places two transactions around a pending victim transaction. The attacker places one transaction before and another right after the victim’s transaction. This type of attack is often used to extract MEV from unsuspecting traders on decentralized exchanges. The attacker manipulates the price of an asset by identifying a token the victim is about to buy, making a trade to push the price up, and then selling the token after the victim’s buy order has increased the price even further.
Back-Running
Back-running is when a malicious actor places their transaction immediately after a known pending target transaction. Searchers use back-running bots to monitor the mempool for new token pair listings or liquidity pools created on decentralized exchanges. When a new token pair listing is found, the bot places a transaction order immediately after the initial liquidity and buys as many tokens as possible, leaving only a small amount for other traders to buy later. The bot can then wait for the price to go up after other traders have purchased the tokens and sell at a higher price for a profit.
Liquidations
Liquidations are a type of attack where searchers specialize in extracting MEV through the liquidation of over-collateralized loans on decentralized on-chain protocols. Liquidators run specialized bots to monitor the network for transactions presenting liquidation opportunities and act to either front-run or back-run transactions to be the first to liquidate a loan. They extract MEV from unsuspecting borrowers by liquidating their loans before they can repay the debt and profit by selling the borrowers’ collateral.
Time-Bandit Attacks
Time-bandit attacks are a type of attack that only miners can execute. These attacks retroactively reorganize blocks to capture MEV opportunities in previously mined blocks. When MEV is high enough compared to block rewards, it can be rational for miners to destabilize the consensus to capture MEV in older blocks. A miner with significant mining power may decide to re-mine previously mined blocks to capture arbitrage opportunities and have a longer chain than the miner who originally mined the block.
Solution
Flashbots
Flashbots is a company that focuses on reducing the negative effects of MEV. They do this by allowing miners to privately and securely pool transactions before they are included in a block. This reduces the incentive for miners to extract MEV by re-ordering transactions. Instead, they can simply include the transactions in the order they were submitted, preserving the MEV for the users who created it.
Flashbots has developed a number of mechanisms to enable this.
One of the most important is the Flashbots Relay, which is a peer-to-peer network that connects miners and transaction senders. The Relay allows miners to receive transaction bundles from users directly, without having to rely on the mempool. This allows for greater privacy and security for users, as well as reducing the incentive for MEV extraction.
Another key mechanism developed by Flashbots is the MEV-Geth client. This client enables miners to access the full set of transactions that are available to be included in a block, rather than just those that are in the mempool. This enables miners to more effectively capture MEV without having to re-order transactions.
In addition to these mechanisms, Flashbots has also developed a number of other tools and technologies to address MEV extraction. These include a transaction simulation tool that allows users to estimate the potential MEV of their transactions, as well as a transaction pool management system that enables miners to manage the transactions they receive.
MEV Stats & Facts
- Total extracted MEV (defined as successful MEV transactions + successful MEV transactions gas fees + failed MEV transactions gas fees) tops $690M.
- In just the past 30 days, over $5M in MEV has been extracted.
- Out of all extracted MEV, 36.4% is MEV miner income while 63.6% is MEV searcher income.
- A vast majority MEV is done through arbitrage; less than one percent is done via liquidation.
- When MEV extraction is sorted by protocol, Uniswap V2 has the largest amount extracted with ~62% of the total. Uniswap V3 and Balancer also each have a substantial amount extracted.
- ETH/WETH are the primary tokens used for MEV profit taking (95% of total).
Cumulative extracted MEV – gross profit. Source: Flashbots
Conclusion
In conclusion, MEV, or Miner Extractable Value, is a term that has emerged in the cryptocurrency industry to describe the profit that miners can earn by manipulating transactions in their favor. While MEV is not a new concept, it has become increasingly prevalent in recent years due to the rise of decentralized finance (DeFi) and the growing competition among miners for transaction fees.
MEV has both positive and negative implications for the cryptocurrency industry. On the one hand, MEV can incentivize miners to contribute to the network’s security by prioritizing more important transactions and blocks. On the other hand, it can also lead to market manipulation and unfair practices that undermine the integrity of the network.
Despite these challenges, companies like Flashbots are working on innovative solutions to mitigate the negative effects of MEV and promote a more equitable and transparent cryptocurrency ecosystem. As MEV continues to be a topic of discussion and debate in the industry, it is crucial for stakeholders to work together to find effective solutions that balance the interests of all parties involved. With continued innovation and collaboration, the potential of blockchain and cryptocurrency can be fully realized, creating a more inclusive and decentralized financial future.