Panoramic Interpretation of DEX MEV: Occurrence, Development and Game-breaking Innovation

AdvancedJan 20, 2024
This article introduces the solutions, prospects and development of DEX MEV.
Panoramic Interpretation of DEX MEV: Occurrence, Development and Game-breaking Innovation

There are always tempting treasures hidden in the dark forest. MEV (Maximal Extractable Value, maximum extractable value) extracts value from users on a first-come, first-served basis. From block congestion issues caused by the Priority Gas Auction (PGA) to possible vulnerabilities between validators and block builders, there are concerns about public issues within the Ethereum ecosystem.

AMM is the most straightforward step in the MEV extraction process, and DEX users are inevitably at risk of MEV bot attacks due to the permissionless visibility of the mempool. At the same time, arbitrage robots play a vital role in improving the price discovery efficiency of AMM and markets.

In this report, we start from the classification of common MEVs in DEX as a whole and their market size, and establish a general understanding of the development stages of DEX MEVs. Zoom in with the magnifying glass and analyze the MEV case from the block explorer. Explore MEV solutions and development directions by comparing and understanding the characteristics of MEV in different DEXs.

At a glance - A Complete Picture Of The Development of DEX MEV’s

DEX MEV is mainly divided into three types: Sandwich, Arbitrage and Liquidation. According to data from EigenPhi, in the past 30 days, $1.64M of arbitrage MEV occurred on Ethereum, $1.74M of Sandwich attack MEV occurred, and $21.01K of liquidation MEV occurred.It can be seen that Arbitrage and Sandwich are the main forms of DEX MEV profit sources, accounting for 99.38%, and are also the focus of this report.

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

Before proceeding, let’s briefly introduce the principles of three MEV-type attacks:

  • Sandwich attack: An attacker influences the price of a target trade and profits from it by monitoring unconfirmed trades and by bribing miners to insert their own trades before and after the target trade.
  • Arbitrage: In the DEX environment, arbitrage usually involves exploiting price differences between different trading platforms. Due to the decentralized nature of the DEX, price updates can lag. Arbitrageurs can realize a profit by buying a low-priced asset on one platform and selling the same asset at a higher price on another.
  • Liquidation: A liquidation event is triggered when the value of a borrower’s collateral falls below a predetermined threshold. At this point, the agreement allows anyone to liquidate the collateral and repay creditors immediately. When the liquidation line is triggered, the liquidation bot inserts a liquidation order to get a fee afterwards.

From the data, we can see that liquidation MEV is not a frequent occurrence, and large liquidation attacks usually occur in extreme markets, which is not difficult to understand from the principle of liquidation MEV attacks. For example, due to the 10-point rally of BTC on October 23rd and 24th, the volume of liquidation MEV was as high as $561K on that day, significantly higher than at other times.

Size and volume of liquidated MEV, source: EigenPhi

Most of the sandwich attacks occur in the leading DEX, Uniswap, which accounts for about 3/4 of the market share. This is closely followed by aggregators. 1inch v5 (Aggregation) and 0x (Exchange) are evenly divided, accounting for 10% of the total MEV. Metamask: Swap Router accounts for 4.8%.

Sandwich attacks are distributed among various routes, source: EigenPhi

82.18% of the profits on a single trade ranged from $0-$10, 6.84% made a profit of $10-$100 on a single trade, and 9.28% lost $10-$100 on a single trade.

MEV profit distribution, source: EigenPhi

Insights - Delve into MEV occurrences from block explorers

In order to understand how MEV occurs and to figure out how the MEV bots’ gains are calculated, we chose a recent sandwich attack from EigenPhi’s website as an example to explain the whole process of an MEV attack. This is a sandwich attack that took place on 2023-10-23 21:00:35. The attacker spent $634.93, earned $6,167.48, and made a profit of $5,532.55.

MEV attack interpretation example, source: EigenPhi

The sandwich attack is divided into three steps: Front-run, Victim, and Back-run, which are tightly packed in block 18413129. To better illustrate each step, we tagged the addresses using the Tag function in Etherscan. The from address of the victim txn is tagged as “Victim”, the interaction addresses in front-run and back-run are tagged as “Attacker”, and the rest of the tags are from the network. “The rest of the tags are from the network.

Front-run: Buy before you buy!

In the front-run, the attacker first transferred 304.03 WETH to Attacker 2, and exchanged 304.027 stETH through the Lido Curve pool with extremely low slippage. Then stETH was exchanged for 259.59 WETH in the Uniswap V2: stETH 2 pool, causing a liquidity shift. (There are 56,000 ETH and stETH in the Lido pool)

Front-run Transaction, source: Etherscan

Victim: You bought precious (and more expensive) tokens

In a subsequent transaction, the victim exchanged 20.37 stETH for 14.81 WETH through the same Uniswap v2 pool. Since the attacker exchanges a large amount of stETH for WETH in advance during the front-run, it causes a shift in the AMM curve, thereby raising the average price of the victim’s WETH/stETH. The victim suffered a MEV attack.

Victim Transaction, source: Etherscan

Back-run: They took the money and ran away😭

BackRun: Subsequently, Attacker 2 exchanged 259.59 WETH back to stETH through this pool, obtaining 307.76 stETH (note: 3.76 more than before). Finally, attacker 2 used the Lido Curve pool to swap stETH out of WETH with extremely low slippage, and transferred it back to the attacker. Profit taken!

Back-run Transaction, source: Etherscan

Settlement screen

The cost was two Gas plus 0.3667 ETH as a tip to the miner, and the revenue was 3.76 WETH for a profit of $5,532.55. From Curve, we see that the victim’s 20.3691 stETH are quoted on the UI as 20.359 WETH, and the victim received only 14.81 ETH, which means that the victim suffered a whopping 37.5% slippage.

Quotation of 20.3691 stETH in Curve, source: Curve UI

Note: The attacker here refers to the MEV Bot, and the real profiteer is the address of the interaction with the Bot, that is, 0xFac…da00 in From.

Eigentx uses Token Flow to display the above process, which makes it easier to review and visualize after understanding, making it more intuitive. The figure below shows the Token Flow of Front-run, Victim, and Back-run in order. The numbers indicate the order of occurrence for readers to sort out their memories.

Token Flow for example MEV attack, source: Eigentx

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

  • First, a large amount of Swap is needed to trigger a shift in liquidity in the AMM curve in advance.
  • Sort the transactions and sandwich the victim Swap between Frontrun and Backrun
  • At the same time, ensure that the victim’s Swap result does not exceed the slippage limit (otherwise the transaction fails)

In the first step, the attacker usually utilizes a Flash Loan to obtain a large initial amount of money. Flash Loan is a unique lending method in the blockchain that can lend a large amount of money at 0% principal, as long as it can be repaid in the same transaction. The second step requires the attacker to have the ability to bundle transactions and broadcast them to nodes around the world in a short period of time, while bribing the miners with ETH to prioritize the packing of this transaction in the block.MEV The attacker also needs to calculate with high precision to ensure that the victim’s Swap slippage does not exceed the agreed upon. It is also necessary to reasonably calculate the amount of bribe to the miner bribe, to ensure that the profit is maximized at the same time, to avoid being used by other MEV attackers Front run, resulting in losses.

Analysis one by one - DEX‘s MEV problems

Here we analyze the top ranking DEXs in terms of transaction volume on ETH chain: DODO, Uniswap, Curve, Pancakeswap, with TVL, transaction volume, rate and slippage being the key indicators. Combined with EigenPhi’s data, let’s start with Uniswap, a DEX that has long held 50% of the market share, to observe the “universal law” of DEX MEV. Uniswap’s abundant trading volume brings a large number of samples for observing MEV, and at the same time, Uniswap comes with many Forks, which is suitable as a benchmark reference. At the same time, Uniswap also comes with a large number of Forks, making it a suitable benchmark reference. Then, by comparing the characteristics of DEX MEVs with other DEX MEVs, we will look for the reasons for the differences and gain a better understanding of DEX MEVs.

1.Uniswap - Typical MEV Bots’ Activities

Uniswap, as the leading DEX with a market share of nearly half on the ETH chain, has the largest number and largest number of MEV transactions and transaction volume. We can draw some universal conclusions from the performance of MEV on Uniswap as a benchmark:

  • There is no conflict of interest between Arbitrage Robot, Sandwich Robot and LP;
  • The occurrence of arbitrage and sandwich attacks is related to the intensity of market price fluctuations;
  • Mining pools with high transaction volumes are more susceptible to value extraction by sandwich bots;
  • Spatial arbitrage involving 2 venues is the most common pattern, with up to over 100 venues involved;
  • There is a positive correlation between profitability and the activity of Sandwichbot.

1.1 There is no conflict of interest between Arbitrage Robot, Sandwich Robot and LP

Let’s first look at the revenue scale of MEV Robots and LP. In the “MEV’s Impact on Uniswap” report, EigenPhi calculated the revenue of V3 LP and the revenue of three robots: arbitrage, sandwich, and JIT from January 1 to October 31, 2022, as shown in the figure below. Looking at revenue size, three MEV robots accounted for more than 25% of LP revenue, amounting to $540 million. This seems to be competing for the market with LPs, trying to take profits that should belong to LPs from traders.。

Profits from arbitrage, JIT and sandwich attacks as well as income from LP transaction fees. Source: EigenPhi

However, according to the correlation coefficient presented by Messari in Dune, arbitrage and sandwich robots have no negative correlation with LP’s income, which means that the occurrence of arbitrage and sandwich MEV has no conflict of interest with LP. This may be because the Sandwich Bot’s attack does not only involve the two currency pairs traded by the user, but will be routed to the head liquidity pool to exchange tokens, such as converting stablecoins USDC and DAI into the ETH required in the currency pair. . To the extent that arbitrage and sandwich attacks bring additional trading volume on top of users’ ordinary transactions, this will not negatively impact LPs’ revenue, and their revenue is more likely to fluctuate with the overall market.

Correlation coefficient matrix between profits from arbitrage, JIT and sandwich attacks and LP transaction fee income, source: Dune, @messari

1.2 The occurrence of arbitrage and sandwich attacks is related to the intensity of market price fluctuations

In order to explore the influencing factors of arbitrage and sandwich robot income, we explored the relationship between its income market price fluctuations. Data from the EigenPhi report demonstrates the quantitative relationship between ETH price changes and arbitrage and sandwich activity, as shown in the chart below. We can clearly observe that as the ETH price fluctuation becomes larger, the total number of arbitrage and sandwich times also increases, showing an obvious positive correlation.

ETH’s 7-day price change percentage (volatility intensity) versus volume of arbitrage and sandwich activity, source: EigenPhi

There are several possible reasons why this phenomenon occurs:

  • Fluctuations in market prices can exacerbate price inconsistencies:Significant fluctuations in the price of ETH can create temporary price inconsistencies between different exchanges. Arbitrage bots exploit these inconsistencies to profit, so arbitrage activity increases during times of large price movements.
  • Large price movements may correspond to low liquidity in the market:Price fluctuations are often related to market liquidity. In less liquid markets, large orders can have a greater impact on market prices, providing opportunities for arbitrage and sandwich trading.
  • Price fluctuations will stimulate trading activity: When ETH price volatility intensifies, traders’ pursuit of potential profits will increase, thereby increasing market activity, which creates conditions for sandwich trading.

1.3 Mining pools with large transaction volumes are more likely to be exploited by sandwich bots to extract value

To observe which liquidity pools are more likely to participate in MEV activity, EigenPhi merged Uniswap V3 pool metadata and MEV activity parameters grouped by pool address in the report. The results show that among the top ten liquidity pools by trading volume, Sandwich Bot can earn more than 80% of the profits. However, only 20% of sandwich trading activity occurs in these liquidity pools.

This means that liquidity pools with large trading volumes are easier for sandwich bots to extract value from. Because liquidity pools with large trading volumes involve more funds and transactions and have better depth, they bring huge profit margins to the limited exploitable slippage in sandwich attacks. However, it should be noted that this does not mean that liquidity pools with smaller trading volumes are not vulnerable to sandwich attacks.

1.4 Some other interesting observations

From the data presented in the EigenPhi report, we can also draw other interesting conclusions to help understand the occurrence of DEX MEV. For example, it can be seen from the distribution combination of the top 10 arbitrage,Space arbitrage involving one Uniswap V3 pool and another venue is the most common pattern.Two common patterns that follow are triangular arbitrage involving one or two Uniswap V3 pools. Some single arbitrage trades may also involve more than 100 venues.

Distribution of the number of different venues for arbitrage models, source: EigenPhi

At the same time, the relationship between the total profit and the total number of activities of the sandwich attack shows that profitability and activity are positively correlated, with most profitable robots having the ability to successfully submit transactions more than 1000 times. (A clerical error in EigenPhi’s report was ‘100’). this meansThe harder-working the sandwich robot is, the more money it earns.

Dot plot of Sandwich Bot attack frequency and profit, source: EigenPhi

2.DODO - Where Does High Volume Come From?

DODO focuses on stablecoin trading, and its active market making strategy brings excellent depth to the stablecoin pool. With a market capitalization of just $42 million, it consistently ranks in the top three by DEX trading volume. MEV on DODO has two characteristics:

  • MEV contributed a high amount of transaction volume to DODO, accounting for approximately 60% of the total transaction volume;
  • MEV on DODO comes mostly from 1inch routes.

2.1 MEV contributed a high amount of transaction volume to DODO, accounting for approximately 60% of the total transaction volume

By comparison, Uniswap has a market capitalization of $41 billion.In other words, DODO achieved 8.6% of Uniswap’s trading volume at a market capitalization of 1% of Uniswap.The reason is that MEV, which uses DODO liquidity, is causing trouble.

Trading volume distribution of top DEX in the past year and week, source: EigenPhi

Data from Dune shows that DODO’s main trading pair on the ETH chain is stablecoins. From the general conclusion, we can understand that mining pools with large transaction volumes are more likely to have value extracted from them by sandwich bots. This is consistent with DODO’s data, and the stablecoin pool has become the main place where MEV attack activities occur in DODO. According to EigenPhi’s research in the “DODO: Where Does High Volume Come From?” report: the total number of transactions subject to sandwich attacks on DODO reached 1,322, with USDC-USDT transactions accounting for 55.99% and DAI-USDT transactions accounting for 44.01%.

Pie chart of share distribution of trading pairs affected in sandwich attacks, source: EigenPhi

Looking at the trading volume distribution of these two stablecoin pairs, approximately 60% of the trading volume comes from sandwich trading. Because the sandwich attack requires large transactions to cause liquidity deviation, although Victim Volume only accounts for about 2% of the share, the front-run and back-run efforts made for this contribute to USDC-USDT and DAI-USDT. 60% of the transaction volume.

Distribution of trading volume in the USDC-USDT and DAI-USDT trading pairs, source: EigenPhi

2.2 MEV on DODO mostly comes from 1inch routing

DODO’s front-end transactions are usually protected by slippage. Transactions exceeding the slippage cannot be completed. The slippage of stablecoin pairs is 0.01% by default.But why does such a high MEV transaction volume still occur?

According to Eigenfi’s data, it can be found that more than half of the transactions of addresses with a victim txn number greater than 20 interact with the 1inch aggregator for routing transactions, as shown in the figure below. As an aggregator, 1inch does not directly provide liquidity for users to complete transactions, but routes orders to liquidity solutions in other DEXs. Its Fusion mode offers three options:

  • Fast mode: suitable for users who want orders to be executed immediately, which means poor prices;
  • Fair mode: users wait briefly in exchange for a more attractive price;
  • Auction mode: Users auction orders and wait up to ten minutes for the best price. \

Routing distribution of address interactions that have been attacked more than 20 times, source: EigenPhi

Simply put, the 1-inch Fusion mode may achieve fast transactions at the expense of large slippage, slowing down the waiting time for users to trade. Although DODO’s front-end has strictly protected users from slippage, using a default slippage tolerance of 0.01% for stablecoins and a default slippage tolerance of 0.5% for mainstream currencies such as BTC and ETH. However, 1-inch routing does not protect users from slippage, which is the fundamental reason why 1-inch aggregator transactions are in danger.

In traditional slippage settings, most DEXs adopt fixed slippage values, such as the 0.3% provided by Uniswap. This static setting has certain limitations, and the occurrence of transaction reversals will bring frustration and potential losses to users. On the other hand, during periods of less volatility, this setting may be too high, leaving the trade vulnerable to MEV attacks.

Launched by DODO front-end”Dynamic Slippage”Achieve optimal slippage tolerance with time series model forecasting. Help users mitigate potential losses during the exchange process while maintaining a high success rate. Leveraging the ARIMA model, a proven and robust time series predictor,Dynamic Slippage has proven 98% accuracy in backtests.

“Dynamic slippage” diagram: the boundary between long-tail asset prices and predictions, source: @DODO

3. PancakeSwap - ‘Uniswap’ of BNB Chain

PancakeSwap has always been the DEX second only to Uniswap in trading volume, with a market share of about 15%. On the BNB chain, Pancake is an absolute giant, monopolizing about 90% of the market share. This is consistent with EigenPhi’s statistical MEV data,Over 90% of the total MEV on the BNB chain comes from activity involving PancakeSwap.The notable features of MEV on PancakeSwap are:

  • Pancakeswap v3 has a significantly smaller MEV ratio on the BNB chain;
  • Sandwich attacks on Pancakeswap v3 are very rare.

Market share of different protocols on the BNB chain, source: Dune

MEV income distribution, proportion and share of Pancakeswap on the BNB chain, source: EigenPhi

3.1 Pancakeswap v3 has a significantly smaller MEV ratio in the BNB chain

Panacakeswap’s dominant position in the BNB chain is just like Uniswap’s in the Etherum chain, and the mechanism design of the two is not completely different. It is difficult to naturally infer that the performance of Pancakeswap v3 on the BNB chain will be consistent with the performance of Uniswap V3 on the Etherum chain.

However, according to EigenPhi’s data in “PancakeSwap V3’s Ascendancy in the MEV Market - A Comprehensive Study”, the number of arbitrage attacks in Pancakeswap v3 on the BNB chain only accounts for 7.65% of the total transactions, and the number of sandwich attacks only accounts for 1.92% of the total transactions. In contrast, Uniswap V3’s MEV transaction volume ratio on the Etherum chain has remained relatively stable at around 50% to 60%. There are two possible explanations for this phenomenon:

  1. chain infrastructure.When comparing the MEV transaction ratio of PancakeSwap V3 on the BNB chain and the ETH chain. It was found that there is a 9.4% MEV ratio on the BNB chain and 30.3% on the ETH chain. This means that the ETH chain and the BNB chain have different MEV ecosystems.

    1. The richness of the protocol.PancakeSwap is the main protocol on the BNB chain, while on the ETH chain, the protocols are more diverse and rich, which provides more MEV opportunities.
    2. MEV middlemen.On Uniswap, sandwich attacks are the main source of MEV, while on PancakeSwap they are rare. Intermediary services like Flashbots make the MEV extraction process much simpler on Ethereum. However, such services are not mature enough on BNB Chain.
    3. MEV infrastructure.Ethereum has introduced mechanisms such as MEV-Boost and MEV-Boost Relay to encourage more validators to join. These facilities make the MEV extraction process more efficient for validators. Ethereum has over 820k validators while BNB Chain only has 29. \
  2. Transaction volume impact.From Uniswap’s universal conclusions, we can know:Under the same conditions, the proportion of MEV activity is highly correlated with large trading volumes.High-volume deals are more likely to generate MEV opportunities and greater MEV volume and MEV revenue. When comparing the transaction volume of each transaction on the two chains, it can also be clearly noticed: the transaction volume on the ETH chain is approximately 10 times that of BNB.

Comparison of the transaction volume of PancakeSwapV3 on the BNB chain and UniswapV3 on Ethereum, source: Dune

3.2 Pancakeswap v3’s sandwich attack is very rare

EigenPhi’s report also shows that compared to PancakeSwap V2, V3’s sandwich attacks are very rare, and its revenue only accounts for 2.32% of the total sandwich revenue. The difference may come from the mechanical characteristics of V3:

  1. Transaction fee adjustment:PancakeSwap V3 introduced four different trading fee tiers (0.01%, 0.05%, 0.25% and 1%), while V2 had a single fee level of 0.25%. Liquidity providers may choose different fee tiers based on market conditions and their own risk tolerance. This dynamic change may lead to a more complex trading environment, making MEV opportunities unstable as liquidity and trading patterns may change over time. \

  2. Improved smart routing:Brings overall improvements to the trading engine by adding split routing functionality and the ability to utilize all possible liquidity in the protocol. The new smart router intelligently finds the best trade routes by leveraging the liquidity of PancakeSwap V3, V2 and StableSwap, with multi-hop and split routing capabilities. By optimizing trade routing and leveraging multiple liquidity sources, PancakeSwap V3 may reduce the potential profitability of a single trade. Because transactions are conducted across multiple pools, this can make potential MEV opportunities more complex and difficult to exploit. Smart routing will also leverage the liquidity provided by market maker integrations to provide traders with the best deals. Users can select or disable certain liquidity sources, which provides users with more flexibility. This avoids potential front-running or back-running behavior of some pools.

4.Curve - Haven of arbitrage for the Clever

Curve, which launched in 2020 and is known as StableSwap, has a unique price curve that differs from the constant product formula curve, allowing its pool to suffer less slippage in the stablecoin AMM market. Curve has a robust ecosystem that allows users to exchange stablecoins with other DEX protocols with lower fees and slippage. Curve’s main businesses include:

  • Stable currency exchange: Classic liquidity pools include 3pool, LUSD/3Crv, etc.;
  • Stable pegged assets: For example, Curve supports ETH’s PoS and synthetic assets, stETH, frxETH, etc.;
  • Unstable Pegged Assets: After Curve V2, users can redeem BTC, ETH, and USDC on Curve’s Tricrypto pool.

This also makes the MEV that occurs on Curve behave differently:

  • Sandwich attack and arbitrage bot revenue accounts for 73% of Curve pool revenue, and arbitrage is active;
  • 80% of the profit from MEV robot revenue is earned by 20% of the robots;
  • Arbitrage opportunities are related to the intensity of market price fluctuations, while sandwich attacks are independent of market price fluctuations.

4.1 Sandwich attack and arbitrage bot revenue accounts for 73% of Curve pool revenue, and arbitrage is active

Curve’s 3Pool, also known as Tri-Pool, provides significant liquidity (approximately $3.4 billion) for three of the top stablecoins in DeFi. This deep liquidity and Curve’s optimization allow 3Pool to generally provide the most capital efficient path to the exchange of USDT, USDC, and DAI compared to other decentralized exchanges such as Uniswap or SushiSwap, which is particularly useful for arbitrageurs and traders. Very beneficial to the investor. According to EigenPhi, revenue from sandwich attacks and arbitrage bots account for 73% of Curve pool revenue. Compared to the 25% ratio in Uniswap, MEV activity on Curve can be described as quite active.

At the same time, Curve has a large and rich trading pair pool of linked assets, and these pools often generate huge arbitrage opportunities. EigenPhi tallied the daily revenue of arbitrage and sandwich bots, as shown in the figure below. On June 13, 2022, stETH decoupled and the arbitrage bot generated considerable profits.

Line chart and proportion of sandwich attacks, arbitrage income and fee income over time in the Curve protocol, source: EigenPhi

4.2 MEV Robot Revenue 80% of profits are earned by 20% of robots

In the report “10M Revenue Drain in 5 Months: MEV impact on Curve”, EigenPhi drew a box plot of the revenue distribution of arbitrage and sandwich robots, as shown in the figure below. As can be seen from the figure: the revenue generated by MEV robots exhibits a fat-tailed distribution. Compared with the normal distribution, the fat tail means that the probability of extreme events is higher, that is, “smart” high-profit robots contribute most of the revenue.

Boxplot of income distribution for arbitrage and sandwich (bars in boxplot represent quartiles, middle line represents median), source: EigenPhi

According to more detailed data from EigenPhi, it can be found that the top 25% of arbitrage robots account for more than 94% of the revenue, and the top 25% of the sandwich robots account for 87.8% of the revenue. The most profitable sandwich bot launched only 14 sandwich attacks, generating over $46,000 in total profits on the Curve stETH pool using just 2 transactions.

4.3 Arbitrage opportunities are related to the intensity of market price fluctuations, while sandwich attacks have nothing to do with market price fluctuations

When EigenPhi looked at the activity of arbitrage and sandwich bots in a report using the frequency of seven-day price fluctuations for ETH, BTC, and CRV, they found that the occurrence of arbitrage trading opportunities was relatively correlated with the intensity of market price fluctuations. However, the opportunities for sandwich bots appear to be independent of the market’s price fluctuations. This is not the same as the universal conclusion obtained by Uniswap (its correlation coefficient is 0.6), which may mean that even in volatile market conditions, sandwich bots that are not smart enough still cannot complete the attack.

This finding is mutually corroborated with 4.2. Combined with the fact that the income of arbitrage robots in 4.1 is much higher than that of sandwich attacks, it is not difficult to infer that compared to Uniswap, sandwich attacks in the Curve pool are more difficult, and highly skilled arbitrage robots have unparalleled room for display in Curve.

One possible reason: Curve offers multi-asset liquidity pools like 3pool and Tricrypto pool, which may make performing a sandwich attack on Curve more complex relative to Uniswap’s simple liquidity pool structure. Multi-asset pools may introduce additional variables and dynamics that may make it difficult for attackers to predict and manipulate prices effectively. This can also be seen in the fat-tailed distribution of MEV revenue, with highly profitable robots at the head contributing the vast majority of MEV revenue.

Another reason is that Curve contains a larger pool of stablecoins, which means the sandwich opportunity will be less dependent on the market’s price fluctuations. A large and rich pool of linked asset trading pairs provides opportunities for arbitrage.

There’s always a bright future: DEX MEV’s solution

From the above, we can understand that there may be huge differences in the distribution of MEV in different DEXs. Different mechanisms, businesses, and technologies all affect the distribution and scale of MEV. Whether it is the infrastructure on the chain, the optimization algorithm, or the mechanism innovation of DEX itself, the market is looking for solutions to overcome MEV. We have tried to summarize the following 5 types of solutions.

1.Private PRC node

A necessary condition for MEV is permissionless visibility of the public memory pool. Transactions through private RPC nodes can be routed directly to the block proposer (proposer), thus effectively being protected from the influence of the public memory pool and executing transactions before malicious front-runners.

PropellerRPC is a plug-and-play RPC solution. After receiving the user’s transaction, the specially set up PropellerSolver will start the algorithm to automatically search for possible backruns. If possible backruns are found, PropellerRPC will bundle the original tx and send it privately to the “honest” builder, and backruns all profits returned to users. Because RPCs are submitted privately to block builders, searchers cannot preempt or get caught in the middle of a transaction. When builders are monitored for inappropriate behavior, such as builders reordering tx at the expense of users, these builders will be blacklisted as “dishonest”.

MEV-Share is an open source protocol that provides a framework for users, wallets, and applications to internalize the MEV created by their transactions. Specifically, it is implemented through a so-called orderflow auction. It allows users to selectively share data about their deals with searchers, who then bid to have those deals included in bundles. Users can choose how to redistribute searcher bids, such as to themselves, validators, or other parties. MEV-Share is trustworthy, neutral, permissionless to searchers, and does not favor any one block builder. Designed to reduce the centralizing impact of exclusive orderflow on Ethereum while enabling wallets and other order flow 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 essential difference between PropellerRPC and MEV-Share is that one uses an algorithm and the search may backruns to return profits to users; the other uses an auction to involve all searchers and return profits to users through full competition. The core of MEV prevented by both is to bypass the public memory pool and send users’ transactions privately to slow down MEV. Most DEXs have integrated private RPC nodes for users to enable and choose.

2. Mechanism innovation - order packaging auction

The user does not need to send a transaction to submit a transaction, but the user is required to send a signed order. All open orders are packaged into a Batch and handed over to the solver to find the optimal solution. The optimization path comes from off-chain Coincidence of Wants (CoW) on the one hand, and relies on on-chain liquidity on the other. The Dutch auction method selects the best solution, and the third-party payment Gas is submitted on behalf of the user. Batch auctions allow transactions within a batch to have the same unified clearing price, so there is no need for miners to reorder transactions.

There are many benefits of order packaging: reducing the chance of orders being rushed or sandwiched, improving prices, increasing available liquidity and optimizing transaction routing. For detailed demonstration, please refer to our other report “CowSwap’s DEX form of future intent?” 》. But this approach has two obvious disadvantages:

  1. It is difficult to determine which of Solvers’ different solutions is optimal.For a single order, it is obviously simple to maximize the user’s income. But if there are multiple users in a transaction, it is difficult to judge the solution between solvers. For example, one solution may be good for A, but not so good for B and C; but another solution may be good for B, but not so good for A and C. The market is not yet sure whether there is a decentralized and reliable standard for judging solvers’ solutions.
    \
    CoWSwap proposes a “maximizing surplus” strategy, choosing a solution that can create the largest overall surplus for all participating users to process packaged orders. This approach is based on the principle of collective optimality rather than individual optimality. In actual operation, solvers consider all orders through algorithmic optimization and try to find an overall optimal match, which may involve completing complex “demand coincidences” across multiple orders to find an overall most efficient trading combination, such that Maximize the total satisfaction of all users. It can be used as a reference for research and study. \

  2. The waiting time will be longer than the execution time.For inactive targets, large price fluctuations may occur while waiting for execution due to the influence of the AMM curve. However, this method provides a better option for participants who perform large transactions, especially those who do not need to complete transactions immediately, such as DAO. It allows these users to trade with better price execution and reduced market impact, while potentially gaining better slippage protection and fee optimization from batch processing. This mechanism can provide significant financial benefits to users who seek cost-effectiveness and can tolerate longer settlement times. This is also the reason why 1/3 of DAO’s transaction volume occurs on CoWSwap (source: Dune).

3. Mechanism innovation - outsourcing orders

CoW, UniswapX, 1inch fusion, etc. all hope to solve the MEV problem through mechanism innovation. If Uniswap is used as the industry benchmark for DEX, outsourced order solutions may even be a trend. Because it is much more convenient to hand over the execution of the order flow to a professional filler. The user signs the transaction order, and the execution logic is pulled from the chain to the off-chain. The counterparty executes the transaction and has a pre-guaranteed transaction result, which is guaranteed by the smart contract verification guarantee.

Specifically, UniswapX outsources the complexity of routing to third-party fillers. These fillers compete to use on-chain liquidity (such as Uniswap v2 or v3) or their own private liquidity pool to execute users’ transactions while paying gas for the users. Anyone can become a third-party filler on UniswapX exchange, and Dutch auction pricing value guarantees the best price. CoWSwap packages transactions, ranks the solver’s solutions, and grants the execution rights of the transaction. 1inch is similar to UniswapX, except that the resolver allows solving in chronological order.

Especially after Uniswap v4 is launched, due to the special nature of Hook, a large number of pools with the same currency pairs will appear. Without powerful tools, it is nearly impossible for users to find the optimal route on their own when faced with the complex mathematics of AMM. So the way to outsource orders is to actually outsource routing and execution to the market and say, whoever gives me the best execution can trade.

The difficulty with this approach is ensuring that these solvers/fillers behave as expected.

  • One solution is to introduce a reputation mechanism: through monitoring, when they misbehave, they are cut off from the order flow and must pay a penalty to be relisted.
  • Another solution is to create a highly competitive market. In this market, user orders can be executed permissionless, meaning anyone can participate. By leveraging MEV-Share, permissionless collaboration between users or order flow providers and MEV Searcher can be facilitated while protecting privacy and commitment. In the long run, this permissionless execution will greatly increase the competitiveness of the market, thereby providing users with better prices.

Another difficulty is: how to benchmark the best execution?

  • The first line of defense, and one that is always guaranteed, is the limit price you set in your order. The second line of defense is EBBO (Exchange Best Bid and Bid) to get the best price visible on the chain, i.e. taking into account quotes from DEXs such as Uniswap, Balancer etc.
  • Due to the existence of private memory pools, providing optimal execution may be limited by memory pool access permissions. In order to solve this problem, you can consider implementing SUAVE. This plug-and-play architecture aims to provide a common memory pool and block building network for all blockchains. In the process of building blocks (block building), the chain will be All pending information is taken into account. \

4. Slippage optimization

To avoid failed trades, DEXs often set higher default slippages. For example, Uniswap provides a default slippage of 0.3%. However, static slippage settings have limitations. If the slippage is too small, the transaction may fail, and if the slippage is too large, it may cause losses to the user. Under certain market conditions, such static settings can lead to severe trading drawdowns, causing frustration and potential losses to users.

DODO’s latest dynamic slippage based on time series prediction model can recommend appropriate slippage to avoid user losses while ensuring the success rate. It utilizes the ARIMA model, a proven and robust time series predictor with dynamic slippage that has demonstrated 98% accuracy in backtesting. Designed to help users reduce potential losses during the exchange process while maintaining a high success rate.

Even for long-tail coins known for their “unpredictability,” 95.8% of actual prices closely followed the predicted confidence intervals. Performance was even better when tested under more stable market conditions, with 97.2% of actual prices staying within the predicted confidence intervals. Demonstrating the flexibility of its model, it can adapt seamlessly to different market sentiments.

“Dynamic slippage” diagram: price prediction and actual trend of long-tail currencies during market fluctuations, source: @DODO

Sushiswap has launched the function of automatically detecting “taxed tokens” (taxed tokens are tokens with transaction “taxes”, that is, additional fees when buying, selling, or transferring tokens). If the UI says “Low Slippage: This transaction may not succeed due to price changes or transfer fees” as shown below, it may be a taxable token. At this point the token’s tax percentage needs to be added to the original tolerance.

Lower slippage trading tax tokens may result in failed trades, Source: SushiSwap

5. Transparency

DEX routes orders to private nodes instead of public trading pools.While protecting users, it also brings systemic risks.Flashbots strives to be permissionless for all market participants. Users can choose where order flow is sent and to which builders when using Flashpots Protect.

The difficulty with this approach is how to eliminate the cat-and-mouse game with searchers from the system design, i.e. without spending a lot of time, investment and resources to identify when someone is actually misbehaving in the system. It’s a system that doesn’t require supervision, that doesn’t require constant human resources in the system to know if it’s working properly.

Conclusion

The MEV cake from the Black Forest has a tantalizing aroma. The profit of DEX MEV in the past 30 days has reached millions of dollars, which means that the losses to users are still relatively large. After explaining the MEV process in detail, we also came up with the necessary conditions for MEV (taking a sandwich attack as an example): 1. Trigger a liquidity shift; 2. Sequence transactions; 3. Ensure that the slippage range is not exceeded. In transaction ordering, miners need to pay fees to bribe miners to ensure that Back-run follows Victim, maximizing profits while ensuring that it is not preempted and exploited by other MEV bots. Bribing miners is a major/major expense for MEV Bot, and triggering liquidity excursions without exceeding the slippage range after the attack also poses difficult computational requirements for MEV Bot. The remaining costs are incurred in hardware facilities to ensure that bundled transactions can be broadcast to nodes around the world in a short time.

Digging deeper into the causes of MEV in DEX, they are related but not identical. Taking Uniswap as a benchmark, there are some universal conclusions. For example, the greater the market volatility, the higher the frequency and profit of sandwich attacks and arbitrage attacks; the profit amount of pools with larger transaction volume tends to be larger; MEV’s income is positively related to the “effort” of MEV bot. However, each DEX has its own characteristics. Based on this, each DEX evolves its own unique distribution in the occurrence of MEV. For example, Curve has a multi-currency pool and a wealth of linked asset trading pairs. Arbitrage is particularly profitable in Curve, and it is not easily affected by market fluctuations, making arbitrage difficult. Another example is that DODO focuses on the trading of stable currency pairs. It uses active market making to provide excellent liquidity depth, allowing MEV’s sandwich attack to take advantage of it, contributing 60% of DODO’s total trading volume. Comparing the performance of PancakeSwap on BNB and Ethereum proves that the mechanical characteristics of DEX are not the only variable that affects MEV distribution. The infrastructure of the public chain and the number of protocols will also change the MEV distribution of the DEX. For example, the Ethereum chain has richer protocols than the BNB chain, providing more options for MEV attacks. In comparison, the occurrence of MEV is also more intense. The higher MEV on Ethereum than the BNB chain in Pancake Swap may also depend on Etherum having a more complete basic design that provides tools for MEV.

Faced with the above scenarios for DEX MEV, from DEX to infrastructure, the Web 3 world is actively seeking solutions. We’ve assembled a list of 5 types of solutions: Private RPC Nodes, Order Packing Auctions, Outsourced Orders, Slippage Optimization, and Transparency. Private PRCs want to stifle MEV discovery by bypassing the unlicensed visibility of public memory pools. Order packing auctions and outsourced orders are both mechanism innovations. The former packages multiple open orders for execution, and through demand coincidence and uniform clearing price, it improves efficiency while preventing MEV bots from manipulating the price by trade ordering, represented by CoWSwap; the latter gives orders to any solver without permission, and after full competition in the market, it selects the most favorable solution for users to execute, and uses “involution” to slow down MEV bot manipulation. “Slip point optimization” is essentially product optimization, represented by DODO’s “Dynamic Slip Points”, which intelligently recommends slip points to guarantee the success rate while leaving no room for sandwich attacks. Transparency is the vision of Flashbots, through the system design to make the user’s order in the black forest under the sun, to maintain normal operation in a self-supervised way.

Disclaimer:

  1. This article is reprinted from [DODO Research]. All copyrights belong to the original author [xiaoyu]. 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