- MEV is the profit block producers can extract by reordering or excluding transactions included in said block, impacting fairness and costs.
- Block producers may profit from transaction manipulation, especially in DeFi applications. Standard techniques include arbitrage, sandwich attacks, and frontrunning.
- By enabling private transactions and randomizing transaction ordering, fair sequencing services can help protect against MEV.
- MEV's impact varies across blockchains; Ethereum is highly vulnerable, while Solana and Cosmos have unique structures that reduce MEV opportunities.
What is MEV in Crypto?
Maximal extractable value, popularly known as MEV, refers to the maximum value miners or network validators can extract by rearranging and reordering transactions waiting to be added to the blockchain.
Picture yourself as a miner or validator in a decentralized blockchain ecosystem. Your goal is to process transactions within the block. But your other goal is, of course, to maximize your income by doing this little service for the network. Miner Extractable Value (MEV) is the additional profit miners or validators can earn by strategically reordering, including, or censoring transactions within the blocks in addition to the standard reward for mined blocks.
This practice significantly affects transaction fees, user experience, and fairness across blockchain networks. Originally, MEV was specific to miners. However, as Proof-of-Stake (PoS) and other consensus mechanisms emerged, it became clear that other entities, such as validators or sequencers, could exploit these opportunities as well. This evolution has led to a broader term: Maximum Extractable Value (MEV, again). Any block producer can extract the “maximum” value by manipulating transaction ordering.
MEV can be viewed as a double-edged sword. While some forms of MEV extraction improve market efficiency (e.g., arbitrage), others harm users and reduce trust in decentralized applications. For developers, understanding the history and nuances of MEV’s evolution—from a PoW-specific term to a universal concept—helps design fair and efficient applications.
Tatum has the fastest block synchronization for Ethereum JSON-RPC.
[.c-wr-center][.button-black]Start Now[.button-black][.c-wr-center]
How is MEV Relevant
Especially on high-volume chains supporting DeFi and complex transactions, MEV holds considerable value as opportunities for profit increase. In some cases, it can drive up gas fees and create worse trading conditions for regular users.
- DeFi Protocols: MEV has major implications in DeFi, where transactions like token swaps, loans, and yield farming involve substantial financial movements. Frontrunning or sandwich attacks, a common form of MEV manipulation, can cause direct financial losses for users.
- High-Volume Token Transfers: During high-activity periods, such as token sales, NFT drops, or high-stakes trading events, the chain can get congested, and fees can become massive. A validator or miner abiding by MEV would want to keep it that way as long as mempool is accounted for.possible or maliciously gain assets at lower prices before a massive transaction in the
- Stablecoin Arbitrage: Since stablecoins are foundational assets in DeFi, they’re often targets for MEV bots, especially during market volatility when price discrepancies across platforms create arbitrage opportunities.
MEV doesn’t just affect users directly involved in the extracted transactions. By driving up gas fees through competitive bidding wars, MEV can indirectly raise transaction costs across the network.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: gRPC vs. RPC: Comparing Protocol Buffers, JSON, Avro, and Thrift[.c-text-center][.c-box][.c-box-wrapper]
During peak times, high transaction fees can discourage users from interacting with DeFi protocols altogether. This is why MEV awareness is essential not only to optimize protocol performance but also to protect users and contribute to the integrity of the decentralized ecosystem.
MEV Strategies
Before we jump into the chapter, there is one important note: Not every MEV strategy is unethical or has only negative consequences for the users. Some can even be helpful and standard occurrences on any market, such as arbitragining. On the other hand, some methods akin to frontrunning are often illegal in the traditional market. However, at the time of the writing, there was no regulation for the cryptocurrency market. Still, traders seek ways to protect from MEV strategies like frontrunning.
From a developer's or manager's point of view, MEV presents a problem that might discourage people from using the platform, thereby lowering potential profit from fees.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: Understanding Mempool in Blockchain[.c-text-center][.c-box][.c-box-wrapper]
Arbitrage
Arbitrage in MEV involves bots taking advantage of price discrepancies for the same asset across different decentralized exchanges (or DEX). Here’s how it typically works:
- A bot scans multiple DEXs for slight price differences on a token pair.
- When a price discrepancy is found (e.g., you can buy a token for $10 on one DEX and sell it for $10.50 on another), the bot executes simultaneous buy and sell orders, pocketing the difference.
- This can help improve price equilibrium across exchanges, but the arbitrage bot’s rapid trades may raise gas fees. This whole process might take just seconds, and the price differences are sometimes minimal.
Frontrunning
Frontrunning occurs when a malicious actor detects a pending transaction in the blockchain mempool, such as a sizeable token purchase. Then, it submits its own transaction to be mined immediately before it:
- An attacker sees a transaction in the mempool that will cause a price increase (e.g., a large buy order).
- The attacker submits a buy order with a higher gas fee. That, in turn, ensures their transaction is mined first. On the graph below, the moment is marked as “Frontrunner Buy.”
- After the victim’s transaction is mined (labeled as "User Buy (After)" in the graph), the attacker sells the token for profit (labeled as "Frontrunner Sell").
- This type of MEV undermines the fairness of decentralized exchanges, increases costs, and reduces the appeal for genuine users.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: Fact or Myth: Gateways Always Outperform Direct RPC Endpoints[.c-text-center][.c-box][.c-box-wrapper]
Sandwich Attacks
Sandwich attacks are a more complex form of frontrunning, exploiting the fact that trades impact token prices:
- A bot detects a user’s pending large buy order (labeled as "User Buy (Initial)." Right after, it submits its buy order using a higher fee (“Bot Buy (Before)”).
- The bot then executes a sell order immediately after the victim’s transaction, profiting from the price increase caused by the original user. This constitutes the last two phases of the graph.
- This leaves the user with worse-than-expected execution prices and higher slippage. If this happens often enough, the trader might lose interest in the platform.
Liquidation Bots
This one is a bit different because it is a part of how smart contract exchanges operate and does not hurt users directly. Many DeFi lending platforms use collateral-based lending, where users risk liquidation (the platform forcefully sells their assets to pay for the debt) if their collateral value falls below a threshold:
- MEV bots scan DeFi lending protocols to identify accounts near liquidation.
- When an account is eligible for liquidation, the bot submits a transaction to liquidate the account and claim the liquidation reward.
- While this can keep protocols solvent, it encourages competition for liquidation rewards. While not harmful, it can lead to increased fees for users.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: How to Become a Blockchain Developer: Ultimate Guide[.c-text-center][.c-box][.c-box-wrapper]
Real-World Examples of MEV in Action
Here are some real-world cases where MEV has affected users to illustrate the concept’s scope and impact:
Uniswap V2 Sandwich Attacks (2021)
In 2021, a well-known sandwich attack on Uniswap caused significant losses for users. A bot detected a pending large buy order, submitted a buy order right before it, and a sell order immediately after, profiting from the price increase. This tactic left the user with a substantially worse price. If this was classified as theft of assets, it would be the second largest “hack” of 2021, extracting $254 million dollars from everyday users.
Compound Liquidation (November 26, 2020)
In another example, liquidation bots on Compound took advantage of market volatility. During a sharp price drop, bots raced to liquidate under-collateralized positions. The competition drove gas fees sky-high, hurting network users who were not directly involved in the liquidations but also preserving the solvency of the smart contract.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: Decoding Blocks: The Pillars of Crypto Innovation[.c-text-center][.c-box][.c-box-wrapper]
MEV Protection: Are There Any Solutions Available?
Several mitigation strategies have been developed by the blockchain industry due to MEV’s potential for abuse:
MEV-Aware Protocols
Some DeFi protocols are adopting designs to reduce MEV vulnerabilities. For example, Curve Finance uses bonding curves to minimize price impact on trades. A smaller price impact means sandwich attacks are less profitable, and the bot operation might not be worth it any more. Other protocols, like MakerDAO, set fixed parameters on liquidations to prevent costly gas bidding wars. Aave’s flash loans facilitate liquidations without requiring high upfront capital, reducing MEV bots' advantages.
Additionally, batch auctions and sealed-bid mechanisms are being explored to counteract MEV. Batching groups trades to make them execute in a single time point. Therefore, the MEV bot cannot manipulate order flow for profit.
Flashbots (Private Transaction Pools)
Flashbots is an Ethereum-based solution that addresses frontrunning and sandwich attacks by creating a private transaction pool.
Users can submit transactions privately to Flashbots, which delivers them directly to miners rather than broadcasting them to the public mempool. This prevents other bots from detecting and frontrunning these transactions.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: Smart Contracts: The Backbone of Decentralized Applications[.c-text-center][.c-box][.c-box-wrapper]
However, Flashbots isn’t without criticism; some argue it introduces centralization risks by routing transactions through specific miners.
Batching Transactions
Some DeFi protocols and DEX aggregators support transaction batching. Users are enabled to bundle multiple actions into a single transaction, effectively having them executed at a single point in time.
By bundling trades, users can reduce MEV exposure since it’s harder for bots to isolate individual trades within a batch.
It’s particularly helpful for users conducting multiple DeFi operations in a single transaction.
Decentralized Sequencers (Fair Sequencing Service)
Specific blockchains are experimenting with fair sequencing to mitigate MEV. It works by introducing randomized transaction ordering:
This approach, pioneered in networks like Optimism, aims to create fair ordering by using decentralized sequencers. Because of the randomness, a layer of security for users is added, protecting them from frontrunning and sandwich attacks.
Sequencer randomness and unpredictability add a layer of security for users against frontrunning and sandwich attacks.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: Tracking Internal Transactions on Ethereum[.c-text-center][.c-box][.c-box-wrapper]
This is not a one-size-fits-all solution, but including it along with its benefits and limitations gives a more comprehensive view of the MEV mitigation landscape. Developers can choose a mix of suitable solutions based on their applications and user base.
MEV Across Different Blockchains
MEV strategies and protections vary from one blockchain to another due to differences in consensus algorithms, transaction fees, and ecosystem maturity. Here’s how MEV manifests in some popular networks:
- Ethereum
Ethereum is the primary battleground for MEV due to its large DeFi and DEX ecosystem. Large volume simply means there is more to extract from unsuspecting users. People have already developed solutions like Flashbots and MEV-aware DeFi protocols specifically for Ethereum. However, even with these protections, Ethereum’s high transaction fees can incentivize MEV bots to remain active. - Cosmos
Tendermint consensus mechanism used by Cosmos limits traditional mining. Yet, it still allows validators to influence transaction orders. Cosmos protocols are less prone to frontrunning due to their cross-chain structure. Nevertheless,MEV opportunities exist, particularly in inter-blockchain transactions involving Cosmos SDK applications. - Solana
Solana’s high throughput and unique consensus mechanism make it less susceptible to traditional MEV attacks. MEV extraction opportunities increase, however, as Solana grows. Jito Labs is working to detect and prevent MEV on Solana, focusing on maintaining low fees and fair transaction ordering. - Polygon
Polygon, an Ethereum Layer-2 scaling solution, faces similar MEV issues as Ethereum due to its compatibility and reliance on Ethereum’s EVM. The team is slowly exploring approaches like Flashbots and integrating MEV-resistant features into its DeFi protocols. Over time, this development will lead to a better user experience.
[.c-box-wrapper][.c-box][.c-text-center]You might be interested in: What Are Blockchain Validiums, and How They Work[.c-text-center][.c-box][.c-box-wrapper]
Future of MEV and the Role of Regulation
Some of the MEV methods are illegal in traditional markets. Therefore, it is relevant to stop by and discuss the aspects of regulation.
Due to its potential to undermine fairness in decentralized finance, the regulation of MEV strategies is being discussed increasingly. There are ongoing debates around self-regulation within the industry, especially as the importance of maintaining transparency and fairness grows. Protocol safety is one of the main concerns of blockchain users, so the self-regulation and development of solutions is a viable option.
A combination of efforts on both the user's and developer's sides will mitigate the MEV attacks in the future.
How Developers Can Mitigate MEV?
Developers can incorporate design strategies to reduce users' vulnerability to MEV, making applications more resilient:
- Price Oracles: Use time-weighted average price oracles (TWAP) to prevent bots from manipulating prices with temporary spikes.
- Randomized Ordering: Where possible, randomize transaction ordering or batch operations to make frontrunning harder for bots.
- MEV-Aware Architectures: Consider integrating protocols like Curve’s bonding curves to minimize the impact of sandwich attacks on price stability.
User-Focused MEV Prevention Techniques
Finally, a few simple strategies for users can reduce MEV-related risks:
- Private Transactions: Encouraging users to submit large or sensitive transactions through private pools to avoid public frontrunning.
- Bundling Transactions: Using DEX aggregators or platforms that support batching to minimize MEV exposure.
Only the fastest calls on the market for your application.
[.c-wr-center][.button-black]Get Started[.button-black][.c-wr-center]
Related posts
Empowering Web3 developers
Build blockchain apps faster with a unified framework for 60+ blockchain protocols.