What Is a Sandwich Attack and How Does It Utilize the Mempool?
A sandwich attack is a type of MEV where an attacker places two transactions around a victim's pending transaction, essentially "sandwiching" it. The attacker monitors the mempool for a large transaction that is likely to cause a significant price impact.
They place a buy order immediately before the victim's trade and a sell order immediately after. The victim's trade executes at a worse price due to the attacker's buy, and the attacker profits from the price difference upon selling.