Sandwich Attack Dynamics
Sandwich Attack Dynamics involve an attacker observing a pending large trade in the mempool and placing a buy order immediately before it and a sell order immediately after it. The attacker profits from the price impact caused by the victim's trade, effectively extracting value from the victim's slippage.
This exploit relies on the attacker's ability to influence transaction ordering, usually through high gas fees or validator cooperation. It is a direct consequence of transparent mempools and the lack of fair sequencing.
Developers combat this by implementing slippage protection, batch auctions, or off-chain order matching that obscures the order of execution. Understanding these dynamics is essential for designing robust automated market makers that protect user capital.
It highlights the tension between public mempool transparency and user financial security.