Sandwich trading, also known as sandwich attacks or sandwiching, is a trading strategy or manipulation technique in the cryptocurrency markets.
It’s used to exploit token price movements caused by transactions on decentralized exchanges (DEXs) to gain profits at the expense of unsuspecting traders.
Based on these parameters, trader A is expected to receive 9.066 token Y.
However, a sandwich attacker strategically places two transactions, one in front of trader A’s transaction and one after, to profit from the price fluctuations.
First, the attacker purchases 0.524 token Y with 0.529 token X with a higher gas fee. This “front order” raises the price of token Y because of how the CPMM model works.
As a result, trader A’s trade only buys 8.975 tokens Y at a higher price than expected. To be precise, trader A receives exactly 1% fewer token Y than anticipated, the maximum slippage trader A indicates that trader A would tolerate.
The sandwich attacker then sells 0.524 token Y at a higher price (“back order”), which was pushed up further after trader A’s transaction is completed, and receives 0.635 token X.
The sandwich attacker makes a profit of 0.106 token X (0.635-0.529=0.106) from this attack.
Generally, the profitability of sandwich attacks increases with the victim’s transaction size and slippage tolerance.
Sandwich trading, when used for manipulative purposes, can have several negative impacts on decentralized exchanges (DEXs) and the broader cryptocurrency ecosystem.
Sandwich trading is a form of market manipulation. It exploits price discrepancies to profit at the expense of other traders. This behavior undermines trust in the market and can deter legitimate participants.
Sandwich victims can suffer financial losses due to the price manipulation. This can lead to dissatisfaction and distrust within the cryptocurrency community.
Repeated sandwich attacks can deter liquidity providers from participating in DEXs, reducing the overall liquidity in the market.
You can consider the following ways to protect your trades from sandwich attacks.
Consider using limit orders instead of market orders whenever possible. While many DEXs don’t provide this order type, some DEXs do have this option. You can consider using DEXs with limit orders, which allow you to specify the price at which you are willing to buy or sell an asset.
You can keep your slippage tolerance relatively lower, which should reduce the potential rewards sandwich attackers can gain from manipulating your trades. Many DEXs, however, use auto-slippage settings now. Setting your slippage too low could also make your trades take longer to process.
A single large trade is the ideal target for sandwich attackers. Breaking them into smaller ones could help mitigate potential slippage.
Here are some strategies that can be potentially implemented by DEXs to mitigate sandwich trading’s negative effects:
DEXs can implement measures to detect and prevent front-running and sandwich trading. This may include order execution delays, randomization of order execution times, and improved matching algorithms.
DEXs can develop or integrate tools that analyze transactions for suspicious trading patterns. These tools can identify and flag potential sandwich attacks for further review.
DEXs can establish clear policies and guidelines for algorithmic trading and high-frequency trading. This helps ensure that trading bots and algorithms operate within acceptable boundaries.
An exchange which does not require users to deposit funds to start trading and does not hold the funds for ...
The difference in price between the lowest asking price and highest bid price on the order book for an asset