Dr. DODO is Researching

Posted on Jan 09, 2024Read on Mirror.xyz

Landscape of DEX MEV: Genesis, Evolution, and Game-Changing Innovations


  • Comprehensive Overview —— The Development of DEX MEV

  • Insightful Details —— Penetrating MEV Occurrences through Block Explorer

    • Front-run: Buying before you do!

    • Victim: You've bought some expensive "chips"

    • Back-run: They ran off with the money 😭

    • Settlement Screen

  • Analysis by Case —— The State of MEV in Various DEXs

    • 1 Uniswap - Typical MEV bots' activities

    • 2 DODO - Where Does High Volume Come From?

    • 3 PancakeSwap - 'Uniswap' of BNB Chain

    • 4 Curve - Haven of Arbitrage for the Clever

      • 4.1 Income from sandwich attacks and arbitrage bots constitutes 73% of Curve pool revenue, with active arbitrage

      • 4.2 80% of MEV bot income is earned by 20% of the bots

      • 4.3 Arbitrage opportunities correlate with market price fluctuations, while sandwich attacks do not

  • Light at the End of the Tunnel —— Solutions to DEX MEV

    • 1 Private PRC nodes

    • 2 Mechanism Innovation — Order Packing Auctions

    • 3 Mechanism Innovation — Outsourcing Orders

    • 4 Slippage Optimization

    • 5 Transparency

  • Conclusion

  • Reference

Special thanks to the EigenPhi team for providing high-quality MEV data, and also to EigenPhi researchers Yixin and Sophie for participating in the article discussion. These data and suggestions were crucial to our analysis.

The MEV (Maximal Extractable Value) in the dark forest of the blockchain is like a tempting treasure, extracted from users in a first-come, first-served manner. From issues caused by priority gas auctions (PGA) leading to block congestion, to potential vulnerabilities between validators and block builders, concerns have been raised about public issues within the Ethereum ecosystem.

AMMs (Automated Market Makers) represent a direct link in the MEV extraction process. Due to the unpermissioned visibility of memory pools, DEX users inevitably face the risk of MEV bot attacks. Meanwhile, arbitrage bots play a crucial role in enhancing the price discovery efficiency of AMMs and markets.

In this report, we start with a classification of common MEV types and their market sizes in DEXs, establishing a general understanding of DEX MEV development stages. Zooming in with a magnifying glass, we analyze MEV cases through block explorers. By comparing and understanding the characteristics of MEV in different DEXs, we explore solutions and development directions for MEV.

Comprehensive Overview —— The Development of DEX MEV

DEX MEV mainly falls into three types: Sandwich Attacks, Arbitrage, and Liquidation. According to EigenPhi's data, in the past 30 days, arbitrage MEV on Ethereum amounted to $1.64M, sandwich attack MEV to $1.74M, and liquidation MEV to $21.01K. It is evident that arbitrage and sandwich attacks are the main forms of profit sources in DEX MEV, accounting for 99.38%, and are the focus of this report.

Performance of Liquidation, Sandwich Attack, and Arbitrage in the past 30 days, source: EigenPhi

Before diving in, let's briefly introduce the principles of these three types of MEV attacks.

  • Sandwich Attacks: The attacker monitors unconfirmed transactions and inserts their own transactions before and after the target transaction by bribing miners, thereby affecting the price of the target transaction and profiting from it.

  • Arbitrage: In the DEX environment, arbitrage often involves exploiting price discrepancies between different trading platforms. Due to the decentralized nature of DEXs, price updates might lag. Arbitrageurs can profit by purchasing assets at a low price on one platform and selling the same assets at a higher price on another platform.

  • Liquidation: Occurs when the value of a borrower's collateral falls below a predetermined threshold. At this point, the protocol allows anyone to liquidate the collateral, immediately repaying the creditors. When the liquidation threshold is triggered, liquidation bots insert a liquidation order to earn a fee.

Data shows that liquidation MEV does not occur frequently. Large-scale liquidation attacks usually happen during extreme market conditions, which is understandable from the principle of liquidation MEV. For instance, due to a 10-point surge in BTC on October 23 and 24, the liquidation MEV trading volume on that day reached $561K, significantly higher than other times.

Scale and number of liquidation MEV, source: EigenPhi

Most sandwich attacks occur in top DEXs, with Uniswap accounting for about 3/4 of the market share. Following closely are aggregators. 1inch v5: Aggregation and 0x: Exchange split the MEV volume equally, each accounting for 10% of the total. Metamask: Swap Router accounts for 4.8%.

Distribution of sandwich attacks across various routes, source: EigenPhi

82.18% of the individual profit amounts fall between $0-$10, 6.84% are between $10-$100, and 9.28% are losses of $10-$100.

Distribution of MEV profits, source: EigenPhi

Insightful Details —— Penetrating MEV Occurrences through Block Explorer

To understand the process of MEV occurrence and figure out the profit calculation of MEV bots, we selected a recent sandwich attack from EigenPhi's website as an example to thoroughly explain the MEV attack process. This was an attack that occurred on 2023-10-23 at 21:00:35. The attacker spent $634.93, earned $6,167.48, and profited $5,532.55.

MEV attack interpretation example, source: EigenPhi

The sandwich attack process is divided into three steps: Front-run, Victim, Back-run. These three transactions are closely arranged and packed together in block 18413129. To better illustrate each step, we used the Tag function in Etherscan to label addresses: the 'from' address of the victim txn as “Victim”, and the interacting addresses in the front-run and back-run as “Attacker”, with the other labels coming from the network.

Front-run: Buying Before You Do!

In the Front-run, the attacker first transfers 304.03 WETH to Attacker 2, who then exchanges it for 304.027 stETH in the Lido Curve pool at a very low slippage. Then, Attacker 2 exchanges the stETH for 259.59 WETH in the Uniswap V2: stETH 2 pool, causing a liquidity shift. (The Lido pool had 56,000 ETH and stETH).

Front-run Transaction, source: Etherscan

Victim: You Bought Expensive "Chips"

The victim, in the subsequent transaction, exchanges 20.37 stETH for 14.81 ETH through the same Uniswap v2 pool. Due to the large amount of stETH exchanged for WETH by the attacker in the Front-run, a shift in the AMM curve occurred, thereby raising the average price of WETH/stETH for the victim. The victim was subjected to an MEV attack.

Victim Transaction, source: Etherscan

Back-run: They Took the Money and Ran 😭

BackRun: Afterwards, Attacker 2 exchanges 259.59 WETH back into stETH via the same pool, obtaining 307.76 stETH (note: 3.76 more than before). Finally, Attacker 2 exchanges the stETH for WETH in the Lido Curve pool at a very low slippage and transfers it back to the attacker, completing the profit-making process.

Back-run Transaction, source: Etherscan

The cost was two gas fees plus 0.3667 ETH as a tip to the miner, with a revenue of 3.76 WETH, resulting in a profit of $5,532.55. From Curve, it was observed that the victim's 20.3691 stETH was quoted as 20.359 WETH on the UI. However, the victim only received 14.81 ETH, meaning they suffered a slippage as high as 37.5%.

Curve quote for 20.3691 stETH, source: Curve UI

Note: The attacker mentioned here refers to the MEV Bot, and the actual profit recipient is the address interacting with this Bot, i.e., the From address 0xFac…da00.

Eigentx displays the above process using a Token Flow method, allowing for an easier understanding, replay, and visualization of the events. Below are the Token Flows for the Front-run, Victim, and Back-run steps, with numbers indicating the sequence of events, for the reader's reference.

Token Flow of example MEV attack, source: Eigentx

From this transaction, we can summarize the necessary conditions for MEV profit:

  • Firstly, a large swap is needed to cause a liquidity shift in the AMM curve.

  • The transactions need to be ordered with the victim's swap sandwiched between the front-run and back-run.

  • It is also crucial to ensure the victim's swap does not exceed the slippage limit (otherwise, the transaction fails).

In the first step, attackers often use flash loans to obtain large initial capital. A flash loan is a unique lending method on the blockchain, allowing borrowing of a substantial amount of funds with zero capital, provided the loan is repaid in the same transaction. The second step requires the attacker to have the ability to bundle transactions and broadcast them to nodes globally in a short time, while also bribing miners with ETH to prioritize packaging this transaction into the block. MEV attackers also need high-precision calculations to ensure the victim's swap does not exceed the agreed slippage and to appropriately calculate the bribery amount for miners, maximizing profits while avoiding being front-run by other MEV attackers and incurring losses.

Analysis by Case —— The State of MEV in Various DEXs

Here, we analyze DEXs on the Ethereum chain that rank high in terms of transaction volume: DODO, Uniswap, Curve, PancakeSwap. Key indicators include TVL (Total Value Locked), transaction volume, fee rates, and slippage. Combining data from EigenPhi, we first observe MEV in Uniswap, which consistently holds about 50% market share, to discern general patterns in DEX MEV. With its rich transaction volume, Uniswap provides a plethora of samples for observing MEV, making it a suitable benchmark. Then, by comparing and contrasting MEV characteristics across different DEXs, we further deepen our understanding of MEV occurrences.

1 Uniswap - Typical MEV bots' activities

Uniswap, as the leading DEX on the Ethereum chain with nearly half of the market share, sees the most significant number and volume of MEV transactions. Observations from MEV on Uniswap can serve as a baseline for general conclusions:

  • Arbitrage bots and sandwich bots do not conflict with LPs' interests.

  • The occurrence of arbitrage and sandwich attacks correlates with market price fluctuations.

  • Pools with higher transaction volumes are more prone to exploitation by sandwich bots.

  • The most common pattern involves spatial arbitrage involving 2 locations, sometimes extending to over 100 locations.

  • Profitability correlates positively with the activity level of sandwich bots.

1.1 Arbitrage bots, sandwich bots, and no conflict of interest with LPs

First, let's observe the income scale of MEV bots versus LPs. EigenPhi's report "MEV's Impact on Uniswap" details the income of V3 LPs and the income of arbitrage, sandwich, and JIT bots from January 1, 2022, to October 31, 2022, as shown in the following figure. In terms of income scale, the income of the three types of MEV bots exceeds 25% of LP income, amounting to $540 million. This seems to compete with LPs for the market, attempting to extract profits from traders that rightfully belong to LPs.

Profit from arbitrage, JIT, and sandwich attacks, and LP transaction fee income. Source: EigenPhi

However, according to the correlation coefficients presented by Messari in Dune, there is no negative correlation between the income of arbitrage and sandwich bots and LPs, meaning that arbitrage and sandwich MEV occurrences do not conflict with LP interests. This could be because sandwich bot attacks do not only involve the two tokens of a user's trade but route to top liquidity pools for token exchanges, such as converting stablecoins USDC and DAI into ETH needed for the pair. To some extent, arbitrage and sandwich attacks bring additional transaction volume outside of users' regular trades, not negatively impacting LP income. Their income is more likely to fluctuate with the overall market.

Correlation matrix of profit from arbitrage, JIT, and sandwich attacks with LP transaction fee income. Source: Dune, @messari

1.2 The occurrence of arbitrage and sandwich attacks relates to market price fluctuations

To explore the factors influencing the income of arbitrage and sandwich bots, we examined their relationship with market price fluctuations. Data from the EigenPhi report showed a clear positive correlation between the ETH price changes and the number of arbitrage and sandwich activities.

Relationship between ETH's 7-day price change percentage (volatility) and the number of arbitrage and sandwich activities. Source: EigenPhi

This phenomenon may be attributed to several reasons:

  • Market price fluctuations exacerbate price inconsistencies: Significant swings in ETH prices could create temporary price discrepancies between different exchanges. Arbitrage bots exploit these inconsistencies for profit, hence the increase in arbitrage activity during periods of high price volatility.

  • Significant price movements may correspond to lower market liquidity: Price volatility is often linked to market liquidity. In markets with lower liquidity, large orders can significantly impact market prices, thereby creating opportunities for arbitrage and sandwich trades.

  • Price volatility stimulates trading activity: When ETH price fluctuations intensify, traders' pursuit of potential profits increases, leading to heightened market activity, which in turn creates conditions favorable for sandwich trades.

1.3 Larger pools are more prone to exploitation by sandwich bots

To determine which liquidity pools are more likely to be involved in MEV activities, EigenPhi merged metadata from Uniswap V3 pools with MEV activity parameters grouped by pool addresses. The results showed that sandwich bots could extract over 80% of their profits from the top ten liquidity pools by transaction volume. However, these pools accounted for only 20% of sandwich trade activities.

This implies that for sandwich bots, pools with larger transaction volumes are more lucrative to exploit. Such pools involve more funds and transactions, offering greater depth and thus more profit opportunities from the limited slippage available in sandwich attacks. However, it's important to note that this doesn't mean smaller liquidity pools are immune to sandwich attacks.

1.4 Other interesting observations

From the data presented in EigenPhi's report, we can derive other intriguing conclusions that help understand the occurrence of DEX MEV. For instance, from the distribution of the top 10 arbitrage combinations, the most common pattern involves spatial arbitrage with one Uniswap V3 pool and another location. The next most common patterns are triangular arbitrages involving one or two Uniswap V3 pools. Some individual arbitrage transactions may even involve over 100 locations.

Distribution of arbitrage patterns by the number of locations involved. Source: EigenPhi

Furthermore, the relationship between total profit and the total number of activities in sandwich attacks indicates a positive correlation between profitability and activity level. Most profitable bots are capable of successfully executing transactions over 1000 times (there is a typographical error in EigenPhi's report stating '100'). This implies that the more 'diligent' the sandwich bot, the higher its income.

Dot plot of sandwich bot attack frequency vs. profit. Source: Eigenphi

2 DODO - Where Does High Volume Come From?

DODO focuses on stablecoin trading, and its proactive market-making strategy brings excellent depth to its stablecoin pools. With a market cap of only $42 million, it consistently ranks in the top three in terms of DEX trading volume. MEV on DODO is characterized by two main features:

  • MEV contributes a high volume of transactions to DODO, about 60% of the total volume.

  • Most of the MEV on DODO comes from 1inch routing.

2.1 MEV contributes a high transaction volume to DODO, about 60% of the total volume

In contrast, Uniswap's market cap is $41 billion. This means DODO achieves 8.6% of Uniswap's transaction volume with only 1% of its market value. The reason behind this is MEV exploiting DODO's liquidity.

Distribution of transaction volume in top DEXs over the past year and week. Source: EigenPhi

Data from Dune shows that the main trading pairs on DODO in the Ethereum chain are stablecoins. From the general conclusions we can draw about Uniswap, we understand that pools with larger transaction volumes are more likely to be targeted by sandwich bots for extraction. This aligns with the data from DODO, where stablecoin pools have become the main venues for MEV attack activities. According to EigenPhi's research in the report "[DODO: Where Does High Volume Come From?]", the total number of trades affected by sandwich attacks on DODO reached 1,322, with USDC-USDT trades accounting for 55.99% and DAI-USDT for 44.01%.

Pie chart distribution of trade pairs affected by sandwich attacks. Source: EigenPhi

Looking at the distribution of transaction volumes for these two stablecoin pairs, approximately 60% of the volume comes from sandwich trades. Because sandwich attacks require large transactions to cause liquidity shifts, even though the Victim Volume only accounts for about 2% of the total, the effort put into Front-run and Back-run contributes 60% of the volume for USDC-USDT and DAI-USDT trades.

Distribution of transaction volumes in USDC-USDT and DAI-USDT trade pairs. Source: EigenPhi

2.2 Most of the MEV on DODO comes from 1inch routing.

DODO's front-end usually has slippage protection for trades, with transactions exceeding the slippage unable to be executed, and the default slippage for stablecoin pairs is 0.01%. So why are there such high volumes of MEV trades?

Data from EigenPhi reveals that in trades with victims transacting more than 20 times, more than half are routed through 1inch aggregator interactions, as shown in the following figure. 1inch, as an aggregator, does not directly provide liquidity for user execution but routes orders to other DEXs with liquidity. Its Fusion mode offers three options:

  • Fast mode: Suitable for users who want immediate execution of orders, meaning worse prices;

  • Fair mode: Users wait briefly for a more attractive price;

  • Auction mode: Users auction their orders, waiting up to ten minutes for the optimal price.

Distribution of routes interacted with by addresses attacked more than 20 times. Source: Eigenphi

In short, 1inch's Fusion mode might execute trades with significant slippage at the expense of quick execution, reducing the waiting time for users' transactions. Despite DODO's front-end having strict slippage protection for users, defaulting to 0.01% for stablecoins and 0.5% for mainstream assets like BTC and ETH, trades routed through 1inch are not protected against slippage, which is the fundamental reason for the high risk in 1inch aggregator trades.

In traditional slippage settings, most DEXs adopt a fixed slippage value, such as the 0.3% offered by Uniswap. This static setting has limitations: in periods of low volatility, it might be too high, making trades vulnerable to MEV attacks. On the other hand, during high volatility, the setting might be too low, leading to failed transactions.

DODO's front-end introduced a "dynamic slippage" feature, using a time-series model to predict and recommend optimal slippage tolerance. This helps users minimize potential losses during exchanges while maintaining a high success rate. Using the ARIMA model, a validated and robust time-series predictor, the dynamic slippage has proven to have a 98% accuracy rate in backtesting.

Illustration of "dynamic slippage": Price of long-tail assets and predicted boundaries. Source: @DODO

3 PancakeSwap - 'Uniswap' of BNB Chain

PancakeSwap consistently ranks second in transaction volume after Uniswap, with a market share of about 15%. On the BNB chain, PancakeSwap is an absolute giant, monopolizing about 90% of the market share. This aligns with EigenPhi's MEV data, showing over 90% of the total MEV on the BNB chain involves PancakeSwap activities. MEV on PancakeSwap is notably characterized by:

  • PancakeSwap v3 has significantly less MEV on the BNB chain.

  • Sandwich attacks in PancakeSwap v3 are extremely rare.

Market share of different protocols on the BNB chain. Source: Dune

Distribution, proportion, and PancakeSwap's share of MEV income on the BNB chain. Source: EigenPhi

3.1 PancakeSwap v3 has significantly less MEV on the BNB chain

Given PancakeSwap's dominant position on the BNB chain, similar to Uniswap on the Ethereum chain, and their similar mechanism designs, one might naturally infer that PancakeSwap v3's performance on the BNB chain would be consistent with Uniswap V3 on the Ethereum chain.

However, according to data from EigenPhi's report "[PancakeSwap V3's Ascendancy in the MEV Market - A Comprehensive Study]", PancakeSwap v3 on the BNB chain experiences only 7.65% of its total trades as arbitrage attacks and 1.92% as sandwich attacks, whereas Uniswap V3 on the Ethereum chain maintains a relatively stable MEV trade ratio of about 50-60%.

This phenomenon might be explained by two potential factors:

  1. Chain Infrastructure. When comparing the MEV transaction ratio of PancakeSwap V3 on the BNB chain and the ETH chain, it was found that the MEV ratio in the BNB chain is 9.4%, while on the ETH chain, it is 30.3%. This indicates that the ETH and BNB chains have different MEV ecosystems.

    1. Protocol Diversity. PancakeSwap is the primary protocol on the BNB chain, whereas the ETH chain has a more diverse and abundant range of protocols, providing more opportunities for MEV.

    2. MEV Intermediaries. On Uniswap, sandwich attacks are a major source of MEV, while they are rare on PancakeSwap. Middleman services like Flashbots make the MEV extraction process simpler on Ethereum. Such services are not as mature on the BNB Chain.

    3. MEV Infrastructure. Ethereum has introduced mechanisms like MEV-Boost and MEV-Boost Relay, encouraging more validators to join. These facilities make the MEV extraction process more efficient for validators. Ethereum has over 820k validators, while BNB Chain has only 29.

  2. Impact of Trading Volume. From the universal conclusions of Uniswap, we know: Under the same conditions, the proportion of MEV activities is highly correlated with large trading volumes. Transactions with larger volumes are more likely to generate opportunities for MEV and greater MEV transaction volumes and revenues. When comparing the transaction volumes on the two chains, it is also noticeable: single transactions on the ETH chain are about 10 times larger than those on the BNB chain.

Comparison of Trading Volumes between PancakeSwapV3 on BNB Chain and UniswapV3 on Ethereum, Source: Dune.

3.2 Sandwich attacks in PancakeSwap v3 are extremely rare

EigenPhi's report also shows that sandwich attacks are very rare in PancakeSwap V3, accounting for only 2.32% of the total sandwich attack revenue. This could be due to V3's specific mechanisms:

  1. Transaction fee adjustments: PancakeSwap V3 introduced four different transaction fee tiers (0.01%, 0.05%, 0.25%, and 1%), compared to V2's single fee level of 0.25%. Liquidity providers might choose different fee tiers based on market conditions and their risk tolerance. This dynamic change might lead to a more complex trading environment, making MEV opportunities unstable as liquidity and trading patterns could vary over time.

  2. Improved smart routing: The addition of split routing capabilities and the ability to utilize all possible liquidity within the protocol brought overall improvements to the trading engine. The new smart router, leveraging PancakeSwap V3, V2, and StableSwap liquidity with multi-hop and split routing capabilities, intelligently finds the best trading routes. By optimizing trading paths and using multiple sources of liquidity, PancakeSwap V3 might reduce the potential profitability of individual trades, as trades are conducted across multiple pools, possibly making potential MEV opportunities more complex and harder to exploit.

4 Curve - Haven of Arbitrage for the Clever

Launched in 2020, Curve is known for its StableSwap, with a unique price curve different from the constant product formula curve, resulting in less slippage for its pools in the stablecoin AMM market. Curve has a robust ecosystem that allows users to exchange stablecoins with other DEX protocols at lower fees and slippage. Key businesses of Curve include:

  • Exchange of stablecoins: Classic liquidity pools like 3pool, LUSD/3Crv, etc.

  • Stable pegged assets: For instance, Curve supports PoS and synthetic assets of ETH, such as stETH, frxETH, etc.

  • Volatile pegged assets: After Curve V2, users can exchange BTC, ETH, and USDC in Curve's Tricrypto pool.

These features give Curve's MEV a distinctive performance:

  • Income from sandwich attacks and arbitrage bots constitutes 73% of Curve pool revenue, with active arbitrage.

  • 80% of MEV bot profits are earned by 20% of the bots.

  • Arbitrage opportunities correlate with market price fluctuations, while sandwich attacks do not.

4.1 Income from sandwich attacks and arbitrage bots constitutes 73% of Curve pool revenue

Curve's 3Pool, also known as Tri-Pool, provides substantial liquidity (around $3.4 billion) for the top three stablecoins in DeFi (USDT, USDC, and DAI). Compared to other decentralized exchanges like Uniswap or SushiSwap, this depth of liquidity and Curve's optimizations typically offer the most capital-efficient route for exchanges between these stablecoins, which is highly advantageous for arbitragers and traders. According to EigenPhi's data, income from sandwich attacks and arbitrage bots constitutes 73% of Curve pool revenue. Compared to Uniswap's 25%, MEV activities in Curve are notably active.

Moreover, Curve's pools with a large number and variety of pegged asset pairs often create substantial arbitrage opportunities. EigenPhi has charted the daily income of arbitrage and sandwich bots, as shown below. On June 13, 2022, when stETH decoupled, arbitrage bots generated considerable profits.

Line graph and proportion of sandwich attack and arbitrage income versus fee income in Curve protocol over time. Source: EigenPhi

4.2 80% of MEV bot profits are earned by 20% of the bots

In the report "10M Revenue Drain in 5 Months: MEV impact on Curve" by EigenPhi, a box plot of the income distribution of arbitrage and sandwich bots is shown. From the plot, it's evident that the income distribution of MEV bots exhibits a 'fat tail'. A 'fat tail' compared to a normal distribution means a higher probability of extreme events, i.e., "clever" high-profit bots contribute the majority of income.

Box plot of income distribution for arbitrage and sandwich (The box body represents the quartile, the middle line represents the median). Source: EigenPhi

According to more detailed data from EigenPhi, the top 25% of arbitrage bots account for over 94% of income, and the top 25% of sandwich bots account for 87.8% of the income. The most profitable sandwich bot initiated only 14 sandwich attacks, achieving over $46,000 in total profits with just 2 transactions in the Curve stETH pool.

4.3 Arbitrage opportunities correlate with market price fluctuations, while sandwich attacks do not

EigenPhi, in their report, observed the activities of arbitrage and sandwich bots against the 7-day price fluctuation frequencies of ETH, BTC, and CRV. They found that the occurrence of arbitrage trade opportunities is relatively related to market price volatility. However, sandwich bot opportunities seem unrelated to market price fluctuations. This contrasts with the general findings from Uniswap (where the correlation coefficient is 0.6), possibly indicating that even in volatile markets, less sophisticated sandwich bots may still fail to execute attacks.

This finding corroborates with point 4.2. Combined with the observation in 4.1 where arbitrage bot income significantly outweighs sandwich attack income, it's plausible to infer that compared to Uniswap, sandwich attacks in Curve pools are more challenging, whereas skilled arbitrage bots have unparalleled room to maneuver in Curve.

One potential reason is that Curve provides multi-asset liquidity pools like 3pool and Tricrypto pool, which might make executing sandwich attacks on Curve more complex compared to Uniswap's simpler liquidity pool structures. Multi-asset pools could introduce additional variables and dynamics, potentially making it more challenging for attackers to effectively predict and manipulate prices. This is also evident in the fat tail distribution of MEV income, where top-performing, high-profit bots contribute the majority of MEV income.

Another reason could be Curve's incorporation of more stablecoin pools, meaning sandwich opportunities would rely less on market price fluctuations. The numerous and diverse pegged asset trading pair pools provide ample arbitrage opportunities.

Light at the End of the Tunnel: Solutions to DEX MEV

Given the diverse distribution of MEV across different DEXs, influenced by various factors like mechanisms, business models, and technological innovations, the market is actively seeking solutions to combat MEV. We have summarized 5 types of solutions:

1 Private PRC Nodes

A key condition for MEV is the unpermissioned visibility of public memory pools. Trading through private RPC nodes can effectively bypass public memory pools, executing transactions ahead of malicious front-runners.

PropellerRPC offers a plug-and-play RPC solution. Upon receiving a user's transaction, a specially designed PropellerSolver launches an algorithm to automatically search for potential backruns. If potential backruns are found, PropellerRPC privately sends the original tx bundled with these backruns to "honest" builders, returning all backrun profits to the user. Since RPCs are privately submitted to block builders, searchers cannot front-run or insert transactions in the middle. Builders displaying misconduct, such as reordering tx at the user's expense, are blacklisted as "dishonest."

MEV-Share is an open-source protocol providing a framework for users, wallets, and applications to internalize MEV generated from their transactions. Specifically, it functions through orderflow auctions, allowing users to selectively share transaction data with searchers who bid to include these transactions in their bundles. Users can choose how to redistribute searcher bids, e.g., to themselves, validators, or others. MEV-Share is trusted, neutral, permissionless for searchers, not favoring any block builder, aimed at reducing the centralizing impact of exclusive orderflow on Ethereum and allowing wallets and other orderflow sources to participate in the MEV supply chain. Users can submit transactions to Flashbots MEV-Share nodes to earn MEV refunds from MEV-share.

The core difference between PropellerRPC and MEV-Share is that the former uses algorithms to search for potential backruns and returns profits to users, while the latter involves auctioning to engage all searchers in competitive bidding, thereby maximizing profit return to users. Both methods aim to mitigate MEV by bypassing public memory pools and privately sending user transactions.

2 Mechanism Innovation — Order Packing Auctions

Users do not need to send a transaction to submit a trade; instead, they send a signed order. All unfilled orders are packaged into a batch and given to solvers for optimization. The optimized path comes partly from off-chain Coincidence of Wants (CoW) solutions and partly relies on on-chain liquidity. The Dutch auction method selects the optimal solution, and a third party pays the gas on behalf of the users. Batch auctions allow trades within a batch to have the same uniform clearing price, eliminating the need for miners to reorder transactions.

The benefits of order batching include reduced chances of front-running or sandwich attacks, improved prices, increased available liquidity, and optimized trade routing. For more detailed arguments, refer to our other report "CowSwap: The Future DEX Form of Intent?". However, there are two apparent disadvantages to this approach:

1. Difficulty in determining the best solution among different solvers' proposals. For individual orders, maximizing user gain is straightforward. But for multiple users in one transaction, judging between solvers' solutions becomes challenging. For instance, one solution might be good for user A but not as beneficial for B and C, while another might favor user B but less so for A and C. The market is still uncertain whether a decentralized yet reliable standard exists to judge solvers' solutions.

CowSwap proposes a "maximizing surplus" strategy, choosing the solution that creates the greatest overall surplus for all participating users. This approach is based on collective rather than individual optimization. In practice, solvers use algorithms to consider all orders and seek the most efficient overall match, involving complex "Coincidences of Wants" across multiple orders, thus maximizing overall user satisfaction. This can serve as a reference for research and learning.

2. Longer waiting time compared to executing individual orders. For inactive assets, significant price fluctuations might occur during the wait due to the influence of AMM curves. However, for participants making large transactions, especially those without an immediate need to trade, like DAOs, this method offers a better option. It allows these users to execute trades at better prices and with reduced market impact, possibly gaining better slippage protection and cost optimization from batch processing. For those seeking cost-effectiveness and tolerating longer settlement times, this mechanism can offer significant economic benefits. This is why one-third of DAO trading volume occurs on CowSwap (source: Dune).

3 Mechanism Innovation — Outsourcing Orders

Projects like CoW, UniswapX, and 1inch Fusion aim to solve MEV issues through mechanism innovation. If Uniswap is considered a standard for DEXs, outsourcing orders could even become a trend. It is much more convenient to hand over the execution rights of order flow to professional fillers. Users sign trade orders, the execution logic is pulled from on-chain to off-chain, and counterparty execution is ensured with smart contract guarantees.

Specifically, UniswapX outsources the complexity of routing to third-party fillers. These fillers compete to use on-chain liquidity (like Uniswap v2 or v3) or their private liquidity to execute users' trades while paying the Gas for users. CoWSwap, on the other hand, bundles trades, ranks solvers' solutions, and entrusts the execution right. 1inch functions similarly to UniswapX, but with resolvers allowed to solve in chronological order.

Especially with the launch of Uniswap v4, due to the special nature of Hooks, a large number of pools with the same asset pair will emerge. Without powerful tools, users will hardly find the best route amidst the complex mathematics of AMMs. Therefore, outsourcing order execution to the market, which then decides who can trade based on who offers the best execution, is a viable approach.

Challenges with this solution include ensuring the expected behavior of these solvers/fillers:

  • One approach is introducing a reputation mechanism: monitoring their actions and cutting them off from order flow when they behave inappropriately, with re-entry requiring a penalty payment.

  • Another approach is creating a highly competitive market where anyone can execute orders permissionlessly. Utilizing MEV-Share can facilitate permissionless collaboration between users or order flow providers and MEV Searchers while protecting privacy and commitments. Over time, this permissionless execution method could significantly increase market competitiveness, offering users better prices.

Another challenge is benchmarking the best execution:

  • The first line of defense, always guaranteed, is the limit price set in the order. The second line is EBBO (Exchange Best Bid and Offer) obtaining the best visible price on-chain, considering DEXs like Uniswap, Balancer, etc.

  • Due to the existence of private memory pools, providing the best execution might be restricted by access to these pools. To address this, implementing SUAVE, a plug-and-play architecture designed to offer a universal memory pool and block-building network for all blockchains, could be considered. This would consider all pending information on-chain during block building.

4 Slippage Optimization

To avoid transaction failure, DEXs often set a higher default slippage, such as the 0.3% default slippage provided by Uniswap. However, static slippage settings have limitations: too small a slippage may lead to transaction failure, and too large a slippage may cause losses to users. In certain market conditions, such static settings can lead to severe trade reversions, causing frustration and potential losses for users.

DODO's newly introduced dynamic slippage, based on time-series forecasting models, recommends appropriate slippage to prevent user losses while ensuring a high success rate. It utilizes the ARIMA model, a validated and robust time-series predictor, and has demonstrated 98% accuracy in retrospective testing, aiming to help users reduce potential losses during swaps.

Even for long-tail coins known for their unpredictability, 95.8% of the actual prices closely match the forecasted confidence interval. In more stable market conditions, the performance is even better, with 97.2% of actual prices staying within the predicted confidence interval, showing the model's flexibility to adapt seamlessly to different market sentiments.

Dynamic Slippage Illustration: Price Prediction vs. Actual Trends of Long-tail Coins During Market Fluctuations, Source: @DODO.

Sushiswap has introduced an automatic detection feature for "tax tokens" (tokens with a transaction "tax," i.e., additional fees for buying, selling, or transferring tokens). If the UI shows "low slippage: due to price movement or transfer fees, this transaction may fail" as shown below, it may indicate a tax token. In this case, the percentage of the token's tax should be added to the original tolerance.

5 Transparency

DEXs route orders to private nodes instead of public memory pools. While protecting users, this brings systemic risks. Flashbots is committed to being permissionless for all market participants. Users can choose where to send their order flow when using Flashpots Protect and to which builders.

The challenge with this solution is how to eliminate the cat-and-mouse game with searchers in system design, i.e., not needing to constantly have human resources to know whether it's working properly. It should be a system that doesn't require active regulation or continuous monitoring to ensure its proper functioning. A system designed for self-supervision, maintaining its operation in a transparent and efficient manner.

Final Thoughts

The MEV cake in the 'dark forest' emits a tempting aroma. DEX MEV has seen profits of up to millions of dollars in the past 30 days, indicating significant losses for users. After a detailed analysis of the MEV process, we identified the necessary conditions for MEV (taking sandwich attacks as an example): 1) triggering liquidity shifts; 2) ordering transactions; 3) ensuring not to exceed the slippage range. In transaction ordering, miners need to pay bribes to ensure that the Back-run follows right after the Victim, maximizing profits while ensuring not to be preempted by other MEV bots. Bribing miners is a major/primary expense for MEV Bots, and causing liquidity shifts without exceeding the slippage range after the attack poses a high computational challenge for MEV bots. Other costs occur in hardware infrastructure, ensuring bundled transactions are broadcast to global nodes quickly.

Exploring the reasons for MEV in DEXs, we find interconnected yet distinct causes. Using Uniswap as a benchmark, some universal conclusions can be drawn. For example, the greater the market volatility, the higher the frequency and profit of sandwich and arbitrage attacks; pools with larger transaction volumes tend to have higher profit amounts; MEV income is positively correlated with the "effort" level of MEV bots. However, each DEX has its own characteristics, which lead to unique MEV distributions. For example, due to the presence of multi-coin pools and a wide range of pegged asset trading pairs, arbitrage in Curve is particularly prominent and less affected by market fluctuations, but more challenging. In contrast, DODO, focusing on stablecoin pairs and providing excellent liquidity depth through active market making, makes it conducive for sandwich attacks in MEV, contributing to 60% of DODO's total trading volume. Comparing PancakeSwap on BNB and Ethereum shows that the characteristics of a DEX are not the only factors affecting MEV distribution; the infrastructure of the underlying blockchain, the number of protocols, etc., can also cause changes in MEV distribution on a DEX. For instance, the Ethereum chain has a richer protocol than the BNB chain, providing more options for MEV attacks, hence more intense MEV activities. The higher MEV on Ethereum than on BNB chain in Pancakeswap might also be due to Ethereum's more comprehensive foundational design, providing tools for MEV.

Faced with the above scenarios of DEX MEV, the Web 3 world is actively seeking solutions, from DEX to infrastructure. We have collected and organized 5 types of solutions: private RPC nodes, order batching auctions, outsourcing orders, slippage optimization, and transparency. Private RPC aims to kill the discovery of MEV by circumventing the permissionless visibility of the public memory pool. Order batching auctions and outsourcing orders are both innovations in mechanisms. The former bundles multiple unfilled orders for execution, preventing MEV bots from manipulating prices through transaction ordering by using Coincidence of Wants and uniform clearing prices, with CoWSwap being the representative project. The latter allows orders to be given to any solver without permission, and after full market competition, the most user-beneficial plan is selected for execution, using "involution" to slow down the evil deeds of MEV bots, with UniswapX being the representative project. Slippage optimization is essentially product optimization, with DODO's "Dynamic Slippage" being the representative project, intelligently recommending slippage to prevent sandwich attacks while ensuring a high success rate. Transparency is Flashbots' vision, exposing users' orders in the dark forest to sunlight through system design, maintaining normal operation in a self-supervised manner.