Skip to article
Degrees of SatoshiFollow the connections.
Degrees of Satoshi/ Encyclopedia

Encyclopedia DeFi · Entry 162

Sandwich attacks: trading around someone else’s swap

Theme
DeFi
Sources
4 cited records
Reading time
About 3 minutes
Automated verification
Substantive update
In this article

At a glance

Key facts

Key facts for Sandwich attacks: trading around someone else’s swap
FactDetailSource
OrderingThe attack depends on arranging activity around the target transaction.[1]
Price effectAMM reserve changes affect the next execution price.[2]
LimitA minimum output constrains accepted execution, not the initial quote itself.[4]
01

Follow the change in the pool’s state

A transaction placed before the target moves the pool price against the target’s direction. The target then trades at the changed state. A later transaction can unwind the attacker’s position after the target’s price movement.

Whether the sequence is profitable depends on liquidity, fees, trade size and ordering. The explanation is a risk model, not a claim that every poor swap was sandwiched.

02

A loose limit can permit a worse fill

If the signed operation allows a broad range of acceptable outcomes, the target may execute at the unfavorable end of that range. Reducing the permitted range can instead cause execution to fail when conditions move too far.

Changing tolerance does not improve the pool’s current quote or remove ordinary price impact from a large trade.

03

Reduce visibility with explicit trust assumptions

Private submission services aim to keep transactions out of the public mempool and offer particular inclusion policies. Their operators and downstream participants still form part of the execution path.

Understand routing, fallback and disclosure behavior. A private route is a mechanism with a scope, not a guarantee that every economically unfavorable ordering is impossible.

Direct answers

Questions people ask

Is every change between quoted and executed output a sandwich attack?

No. Ordinary intervening trades, price movement, routing and quote age can also change the result. Establish the actual ordering and state changes before attributing an attack.

Inspect the evidence

The answer and key facts have stable claim links. These records retain the scope and qualification when reused.

A sandwich attack places transactions before and after a target swap to exploit how that swap changes pool prices. The target can receive a worse execution while still meeting a permissive minimum-output condition. Tighter enforced limits and suitable private or order-based routes can reduce exposure, but no single setting guarantees protection from every form of MEV.

Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.

Link to this claim
Ordering: The attack depends on arranging activity around the target transaction.

Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.

Link to this claim
Price effect: AMM reserve changes affect the next execution price.

Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.

Link to this claim
Limit: A minimum output constrains accepted execution, not the initial quote itself.

Scope: DeFi · data through 2026-10-02. Verification: verified · 2026-10-02T18:15:18.493Z.

Link to this claim
Revision history
  1. — First publication after primary-source research and independent automated verification.

Source register

Sources and references

Retrieval dates and locators are recorded individually.
  1. Maximal extractable valueethereum.org contributors

    Ordering-dependent extraction and limits of private submission.

    Locator: Sandwich trading; MEV protection · Retrieved: 2026-10-02T17:03:45.625ZOpen source
  2. Uniswap v2 whitepaperUniswap

    Full-range constant-product inventory and cumulative-price oracle design.

    Locator: Price oracle; Liquidity; Fees · Version / scope: Uniswap v2 whitepaper, March 2020 · Retrieved: 2026-10-02T17:03:45.008ZOpen source
  3. Flashbots Protect overviewFlashbots

    Private submission changes who receives a transaction and depends on relay and builder behavior.

    Locator: MEV protection; Privacy; How it works · Retrieved: 2026-10-02T17:03:45.401ZOpen source
  4. UniswapX overviewUniswap

    Signed order execution through fillers; execution conditions are mechanism-specific.

    Locator: Signed orders; Fillers; Dutch auctions · Retrieved: 2026-10-02T17:21:47.712ZOpen source
How this article was made

Research and drafting use AI assistance. A separate automated review checks claims against primary sources; no external expert or named human review is implied. Publication, substantive editing, source retrieval and verification are recorded separately. This version was independently checked by an automated reviewer on 2 October 2026.

Editorial method and corrections

Degrees of Satoshi editorial project. “Sandwich attacks: trading around someone else’s swap.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/sandwich-attacks/