Hello everyone, I am Paul Miyi, a small programmer, and this is the 6th day of learning blockchain from scratch together (if you are interested in blockchain technology, you can follow me for shared learning). Today, we want to talk about transaction slippage.

In decentralized exchanges (DEXs) on the blockchain, transaction slippage refers to the deviation between the user's actual trading price and the expected trading price. It is a common phenomenon on DEXs, especially in cases of low liquidity or high trading volume.

One, sources of transaction slippage

1. Price volatility

Transactions on the blockchain are usually transparent, and transaction information is broadcasted on-chain. During the time interval from initiating the transaction to confirming it, prices may change due to the execution of other transactions, leading to slippage.

2. Liquidity pool depth

Transactions in DEXs rely on the Automated Market Maker (AMM) model, which is centered around liquidity pools. The depth of asset pairs in the pool directly affects slippage:

  • High depth (sufficient liquidity): lower slippage.

  • Low depth (insufficient liquidity): significant slippage.

3. Trading volume

In the AMM model, the transaction price is dynamically adjusted based on a constant formula (for example, Uniswap's x×y=k). Large transactions significantly change the asset ratio in the liquidity pool, leading to increased slippage.

Two, how to calculate slippage

Slippage is usually expressed as a percentage, calculated as follows:

Example:

  1. Assuming the user plans to exchange 1 ETH for 2000 USDT.

  2. When the transaction is actually completed, due to slippage, 1 ETH can only be exchanged for 1980 USDT.
    Slippage is:

Three, the impact of slippage on users

  1. Small transactions: minimal slippage impact

    For users with smaller transaction volumes, slippage is usually negligible, especially in well-capitalized pools.

  2. Large transactions: significant slippage

    When the transaction amount is large, slippage may cause losses for users. In extreme cases, slippage may even render the transaction meaningless.

Four, measures to cope with slippage

  1. Set slippage tolerance

In many DEXs (like Uniswap, PancakeSwap), users can manually set their slippage tolerance. If the slippage exceeds the tolerance range, the transaction will be automatically canceled.

  • The generally recommended slippage tolerance is 0.1% to 0.5%.

  • For highly volatile tokens, it can be appropriately raised to 1% to 3%.

2. Split transactions

Split large transactions into multiple smaller transactions to reduce the impact of each transaction on the liquidity pool, thereby lowering slippage.

3. Choose pools with high liquidity depth

Use liquidity pools with high liquidity and trading pair depth. For example, mainstream tokens (ETH, USDT) usually have lower slippage, while niche tokens tend to have higher slippage.

4. Avoid peak times

Peak periods on the blockchain network may cause greater slippage due to congestion. Choosing to trade during less busy times helps to reduce slippage.

Five, slippage and price impact

Slippage is closely related to price impact. Slippage reflects the deviation of the actual price from the expected price, and trading behavior has a direct impact on prices in the pool.

Six, special considerations for slippage

  1. Front running issues

    If the slippage setting is too high, it may be exploited by front-running attackers, who can detect user transactions and place orders in advance for profit.

  2. Trading highly volatile tokens

Some newly issued or low liquidity tokens have extremely high slippage, so special attention should be paid to slippage settings to prevent transactions from being accidentally executed at poor prices.