Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

Sandwich Attack

1 min read
Pronunciation
[sand-wich uh-tak]
Analogy
Think of a sandwich attack like placing two slices of bread around someone’s order at a deli: you buy before they do and sell immediately after to capture the price difference.
Definition
A strategy where an attacker observes a pending transaction in the mempool, places a buy order before it and a sell order after it, profiting from the price movement caused by the victim’s trade.
Key Points Intro
Sandwich attacks extract value by front-running and back-running victim transactions.
Key Points

Front-running: attacker’s buy order executes before victim’s transaction

Back-running: sell order executes immediately after victim’s transaction

Profit extraction: exploits slippage caused by large orders

MEV context: a form of miner/validator extractable value

Example
An MEV bot on Ethereum detects a large DEX swap, buys the token just before the swap to drive the price up, then sells right after the victim’s trade.
Technical Deep Dive
Bots monitor the mempool via full-node RPC/WebSocket, calculate optimal gas prices to prioritize their front-run transaction, then submit both transactions in a single bundle (e.g., via Flashbots). Slippage tolerances and gas estimation algorithms are tuned to maximize profit while avoiding failed transactions.
Security Warning
Victims may incur high slippage and elevated gas fees; front-running bots can congest the network.
Caveat
Highly competitive environment; profit margins shrink as more bots compete for the same opportunities.

Sandwich Attack - Related Articles

No related articles for this term.