Sandwich Trading Meaning
Sandwich trading (or a Sandwich Attack) is a sophisticated form of Maximum Extractable Value (MEV) where a bot exploits the transparency of the blockchain mempool to profit from a retail user's pending trade. The bot sandwiches the user's transaction by placing one order right before it and another order right after it, effectively stealing the Slippage that the user was willing to accept.The mechanics involve three steps.
First, the bot sees a user's large Buy order in the mempool. The bot submits its own Buy order with a higher gas fee to get processed first (Front-running), which pushes the price up.
Second, the user's order is processed at this higher, slipped price. Third, the bot immediately submits a Sell order to get processed right after the user (Back-running), selling its tokens at the now-inflated price for a guaranteed profit.This practice is highly controversial as it acts as a Hidden Tax on DeFi users, often costing them 0.5% to 2% of their trade value without them realizing why.
To defend against this, many users now use Private RPCs (like Flashbots Protect) which send their transactions directly to miners/validators without showing them in the public mempool. This hides the trade from sandwich bots, ensuring the user gets a fair price and the bots have nothing to Front-run.