From CEX to DEX, finally realizing the complete form of CeDeFi
The Web3 industry is developing so fast that new things appear every day. Therefore, many daily thoughts are worth recording.
JinseFinanceSource: DODO Research
*Special thanks to the EigenPhi team for providing high-quality MEV data, and to EigenPhi researchers Yixin and Sophie for participating in the discussion of the article. These data and recommendations are critical to our analysis.
There are always attractive treasures hidden in the black 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 due to the permissionless visibility of the memory pool, DEX users are inevitably at risk of being attacked by MEV bots. 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 and their market size, and establish a general understanding of the development stages of DEX MEV. 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.
DEX MEV is mainly divided into three types, sandwich attack (Sandwich) and arbitrage (Arbitrage) and liquidation (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.
Liquidation Sandwich Arbitrage performance in the past 30 days, source: EigenPhi
Before proceeding, let’s briefly introduce the principles of three MEV types of attacks:
Sandwich attack: The attacker monitors unconfirmed transactions and bribes miners to insert his own transactions before and after the target transaction, thereby affecting the price of the target transaction and profiting from it.
Arbitrage:In a DEX environment, arbitrage often involves exploiting price differences between different trading platforms. Due to the decentralized nature of DEXs, price updates may lag. Arbitrageurs can make profits by buying an asset at a low price on one platform and selling the same asset at a high price on another platform.
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 pay creditors immediately. When the liquidation line is triggered, the liquidation robot will insert a liquidation order after it to obtain fees.
It can be seen from the data that liquidation of MEV does not happen often. Large-scale liquidation attacks usually occur in extreme market conditions. Based on the attack principle of liquidating MEV, this does not It's not difficult to understand. For example, due to the 10-point rise in BTC on October 23 and 24, the trading volume of liquidated MEV was as high as $561K on that day, which was significantly higher than at other times.
Size and volume of liquidated MEVs, source: EigenPhi
Sandwich Most of the attacks occurred on 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 equally divided, accounting for 10% of the total MEV. Metamask: Swap Router accounts for 4.8%.
Sandwich attacks are distributed in various routes, source: EigenPhi
82.18% of the single profit amount is between $0-$10, 6.84% of the single profit is $10-$100, and 9.28% of the single loss is $10-$100.
MEV profit distribution, source: EigenPhi
In order to understand the occurrence process of MEV and clarify the calculation of the income of MEV robots, from EigenPhi’s website, we chose a recent sandwich attack as an example to explain in detail the entire process of MEV attacks. . This is a sandwich attack that occurred at 2023-10-23 21:00:35. The attacker spent $634.93, earned $6,167.48, and gained $5,532.55.
MEV attack interpretation example, source: EigenPhi
Whole sandwich attack The process is divided into three steps: Front-run, Victim, and Back-run. These three transactions are closely arranged and packaged in block 18413129. In order to better explain each step, we use the Tag function in Etherscan to mark the addresses. The from address of the victim txn is marked as "victim", and the interaction addresses in front-run and back-run are marked as "attack" ", and the rest of the labels come from the Internet.
In 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
The victim went through the same transaction in a subsequent transaction. Uniswap v2 pool, exchanged 20.37 stETH for 14.81 WETH. 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
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. Take profit.
Back-run Transaction, source: Etherscan
The cost is two Gas plus 0.3667 ETH as tip to the miners, the income is 3.76 WETH, and the profit is $5,532.55. Seeing from Curve the victim’s 20.3691 stETH was quoted on the UI as 20.359 WETH. The victim only received 14.81 ETH, which means 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, which is 0xFac…da00 in From.
Eigentx uses Token Flow to display the above process. After understanding, it is convenient to review and visualize, and it is 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.
Example MEV attack Token Flow, source: Eigentx
From this transaction, we can summarize the necessary conditions for MEV to make a profit:
First of all, Large Swap triggers a shift in liquidity in the AMM curve in advance
Sequence 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, attackers usually use flash loans to (Flash Loan) Get a large amount of initial capital. Flash loan is a unique loan method in the blockchain. As long as the repayment can be completed in the same transaction, a large amount of funds can be loaned with 0 principal. 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. At the same time, they use ETH to bribe miners to give priority to packaging this transaction in the block. MEV attackers also need high-precision calculations to ensure that the victim's Swap slippage does not exceed the agreement. It is also necessary to reasonably calculate the amount of bribes to miners to ensure maximum profits while avoiding losses caused by other MEV attackers using front run.
Here is an analysis of the DEXs with the highest trading volume on the ETH chain: DODO, Uniswap, Curve, Pancakeswap. TVL, trading volume, rates, and slippage are important primary indicators. Combining EigenPhi data, we first observe the "universal law" of DEX MEV from Uniswap, a DEX that has occupied 50% of the market share for a long time. Uniswap's rich transaction volume brings a large number of samples for MEV observation. At the same time, Uniswap is also accompanied by many Forks, which is suitable as a benchmark reference. Then, by comparing the characteristics of other DEX MEVs, we find the reasons for the differences and gain further understanding of the occurrence 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 most and largest MEV Regarding the number of transactions and transaction volume, we can use the performance of MEV on Uniswap as a benchmark to draw some universal conclusions:
Arbitrage robots, sandwich robots and LPs have no conflict of interest;
The occurrence of arbitrage and sandwich attacks is related to the intensity of market price fluctuations;
Mining pools with large transaction volumes are more likely to be extracted by sandwich bots;
Space arbitrage involving 2 venues is the most common model, involving up to more than 100 places;
Profitability is positively correlated with the activity of the sandwich robot.
1.1 There is no conflict of interest between arbitrage robots, sandwich robots and LPs
Let’s first observe the income of MEV robots and LPs scale. In the "MEV's Impact on Uniswap" report, EigenPhi calculated the income of V3 LP and the income of three types of 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 impact on LP's income. Correlation, which means that arbitrage and sandwich MEV occur with no conflict of interest for the 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 of 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 arbitrage and sandwich attacks Factors affecting 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 (fluctuation intensity) quantitative relationship with 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 ETH prices may occur on different exchanges temporary price inconsistency. Arbitrage bots exploit these inconsistencies to profit, so arbitrage activity increases during times of large price movements.
Large price fluctuations may correspond to low market liquidity: 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 fluctuations intensify, traders will increase their pursuit of potential profits, thereby increasing the market activity, which creates conditions for the sandwich trade.
1.3 Mining pools with large transaction volumes are more likely to be extracted by sandwich bots
In order to observe which liquidity pools More likely to be involved 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 observational conclusions
From the data presented in the EigenPhi report, we can also draw other interesting conclusions to help understand the DEX MEV occur. For example, looking at the distribution combinations of the top 10 arbitrages, it can be seen thatspace 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 in the arbitrage model, source: EigenPhi
At the same time, the relationship between the total profit of the sandwich attack and the total number of activities shows that profitability and activity are positively correlated, and most profitable robots have the ability to successfully submit transactions more than 1,000 times. (A clerical error in EigenPhi’s report was ‘100’). This meansthe harder-working the sandwich robots earn more.
Dot plot of SandwichBot 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 stability to the stablecoin pool. Excellent depth. 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 contributes a high amount of transaction volume to DODO, accounting for approximately 60% of the total transaction volume ;
Most of the MEV on DODO comes from 1inch routing.
2.1 MEV contributed a high amount of trading volume to DODO, accounting for about 60% of the total trading volume
With In 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
Dune data 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 the 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 USDC-USDT and DAI-USDT trading pairs, source: EigenPhi
2.2 Most of the MEV on DODO comes from 1inch routing
DODO’s front-end transactions usually have slippage protection, which exceeds the slippage The transaction cannot be completed, and the slippage of the stablecoin pair defaults to 0.01%. Why does such a high MEV transaction volume still occur?
According to data from Eigenfi, 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 provides three options:
Fast mode: suitable for users who want orders to be executed immediately, which means poor prices;
Fair mode: the user waits briefly in exchange for a more attractive price;
Auction mode: the user auctions the order , wait up to ten minutes for the best price.
Route 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.
"Dynamic Slippage" launched by DODO front-end uses time series model predictions to achieve optimal slippage tolerance. 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 demonstrated 98% accuracy in backtesting.
"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 with the second largest trading volume after Uniswap. The share is 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, with more than 90% of the total MEV on theBNB chain coming from activity involving PancakeSwap. The salient features of MEV on PancakeSwap are:
Pancakeswap v3 has a significantly smaller proportion of MEV in the BNB chain;
Sandwich attacks on Pancakeswap v3 are very rare.
Market share of different protocols on the BNB chain, source: Dune
MEV's income distribution, proportion and share of Pancakeswap on the BNB chain, source: EigenPhi
< strong>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 in the Etherum chain, and the mechanism design of the two is not completely different. 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 on Pancakeswap v3 on the BNB chain only accounts for 7.65% of the total transactions, and the number of sandwich attacks is only Accounting for 1.92% of the total transactions, in contrast, Uniswap V3's proportion of MEV transaction volume on the Etherum chain has remained relatively stable at around 50% to 60%. There are two possible explanations for this phenomenon:
The basic facilities of the chain. 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.
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.
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.
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.
The impact of transaction volume. From the universal conclusion of Uniswap, we can know:Under the same conditions, the proportion of MEV activity is highly correlated with large transaction volume. Higher 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
p>
3.2 Sandwich attacks on Pancakeswap v3 are very rare
EigenPhi’s report also shows that compared to PancakeSwap V2, V3’s sandwich Attacks are so rare that they account for only 2.32% of Sandwich's total revenue. The difference may come from the mechanism features of V3:
Transaction fee adjustment:PancakeSwap V3 introduces four Different trading fee tiers (0.01%, 0.05%, 0.25% and 1%), while V2 has 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.
Improved Smart Routing: brought to the trading engine by adding split routing functionality and the ability to leverage all possible liquidity in the protocol Overall improvements. 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 was launched in 2020 and is famous for StableSwap. The unique price curve 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:
Stablecoin 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 in Curve’s Tricrypto pool.
This also makes the MEV occurring on Curve behave differently:
80% of the profits of MEV robots are earned by 20% of the robots;
Arbitrage opportunities are related to the intensity of market price fluctuations, while sandwich attacks have nothing to do with market price fluctuations.
4.1 The income from sandwich attacks and arbitrage robots accounts for 73% of the Curve pool income, and arbitrage is active
Curve’s 3Pool, also known as Tri-Pool, provides a large amount of 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 attack, arbitrage income and fee income in Curve protocol over time, source: EigenPhi
4.2 MEV robot income 80% of profits are earned by 20% of robots
In the report "10M Revenue Drain in 5 Months: MEV impact on Curve", EigenPhi plotted the revenue distribution of arbitrage and sandwich robots. Box plot, as shown 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.
Arbitrage and sandwich income distribution Box plot (the bars in the box plot represent the quarter points, and the middle line represents the median), source: EigenPhi
According to more detailed data from EigenPhi, you can It was found that the top 25% of arbitrage robots accounted for more than 94% of the revenue, and the top 25% of the sandwich robots accounted 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 are not related to market price fluctuations
EigenPhi uses ETH, BTC and CRV in the report The frequency of 7-day price fluctuations When observing the activities of arbitrage and sandwich robots, we found that the occurrence of arbitrage trading opportunities is relatively related to 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 confirmed 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 is: Curve provides multi-asset liquidity pools like 3pool and Tricrypto pool, which may make performing a sandwich attack on Curve more complex compared 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 stablecoin pool, which means that 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.
As can be understood from the above, there may be huge differences in the distribution of MEV in different DEXs, mechanisms, and businesses. , different technologies are affecting 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 RPC nodes
A necessary condition for MEV is permissionless visibility of the public memory pool, and transactions through private RPC nodes can be routed directly to the zone Block proposers, effectively shielding themselves from the public mempool 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
Users do not need to send a transaction to submit a transaction, but need 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 " What is the DEX form of CowSwap Intent in the future? 》. But this approach has two obvious disadvantages:
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.
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 problem through mechanism innovation MEV problem. 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 would be 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 solution is ensuring that these solvers/fillers behave as expected.
One solution is to introduce a reputation mechanism: through monitoring, if they misbehave, they will be cut off from the order flow , and must pay a penalty to relist.
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 best execution?
The first line of defense, which is always guaranteed, is the limit price you set in the 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
In order to avoid transaction failure, DEX often sets a higher default slippage, such as 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 interval. 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
< /p>
Sushiswap has launched the function of automatically detecting "taxed tokens" (taxed tokens are tokens with transaction "taxes", that is, buying, selling or transferring additional fees when using 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.
Low slippage trading tax tokens may cause trades to fail, source: SushiSwap
5. Transparency
DEX routes orders to private nodes instead of public trading pools. Protecting users also creates 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 solution is how to eliminate the cat-and-mouse game with searchers from the system design, that is, without spending a lot of time, investment and resources to identify when someone is in the system Actual misconduct. 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.
Written at the end
The MEV cake from the Black Forest exudes a tempting 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 liquidity deviation; 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.
Deeply study the causes of MEV in DEX, which are related but different. 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 Etherum 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 Etherum 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 Etherum than the BNB chain in Pancakeswap may also depend on Etherum having a more complete basic design that provides tools for MEV.
Facing the above situation of DEX MEV, from DEX to infrastructure, the Web 3 world is actively seeking solutions. We have collected and compiled 5 types of solutions: private RPC nodes, order packaging auctions, outsourced orders, slippage optimization and transparency. Private PRC hopes to stifle MEV discovery by bypassing permissionless visibility into public memory pools. Order packaging auctions and outsourcing orders are both mechanism innovations. The former packages multiple open orders for execution, and through demand coincidence and unified clearing price, it improves efficiency while preventing MEV bot from using transaction ordering to manipulate prices. The representative project is CoWSwap; the latter hands over orders to any solver without permission. After full competition in the market, the solution that is most beneficial to users is selected and implemented, and "involution" is used to slow down MEV bots from doing evil. The representative project is UniswapX. Slippage optimization is essentially product optimization. The representative project is DODO's "dynamic slippage". The intelligent recommendation of slippage ensures the success rate while allowing sandwich attacks to take advantage of it. Transparency is the vision of Flashbots. Through the design of the system, the user's orders in the black forest shine in the sun and maintain normal operation in a self-supervised manner.
The Web3 industry is developing so fast that new things appear every day. Therefore, many daily thoughts are worth recording.
JinseFinanceA common topic, how should on-chain perp dex compete with other competitors, even CEX?
JinseFinanceSatflow is a new DEX for professional traders built on the Bitcoin network.
JinseFinanceEthervista is a new competitor to Pump.fun on Ethereum. Here’s everything you need to know about the token launcher DEX.
JinseFinanceArtexSwap is a decentralized exchange that uses Artela EVM++ and Aspect technology to solve MEV risks and Rug Pull problems, improves transaction security and efficiency, and is suitable for decentralized trading scenarios that require high security and flexibility.
JinseFinanceMacaron offers Macaron DeFi points worth up to $200K.
JinseFinanceThis article looks at the mechanics of CEX/DEX arbitrage trading, focusing on the AMM aspects of execution, aiming to show the relationship between block time, block base fee, and the participants involved in these trades.
JinseFinanceThe market expects that Base chain is expected to take over the overflow funds from the Solana meme craze, and market participants are betting on the successful investment of Raydium by betting on Aerodrome, the leading Base chain DEX project. Let’s analyze the intrinsic value of Aerodrome together.
JinseFinanceNowadays, cryptocurrencies are moving into DeFi. It’s a good option to be the one who manages your digital capital and ...
BitcoinistThe Dfinity Foundation's Internet Computer blockchain welcomed its first decentralized exchange, Sonic.
Cointelegraph