{
  "$schema": "https://degreesofsatoshi.com/encyclopedia/schemas/article-v1.json",
  "schemaVersion": "1.0.0",
  "id": "sandwich-attacks",
  "canonical": "https://degreesofsatoshi.com/encyclopedia/sandwich-attacks/",
  "collection": "defi",
  "title": "Sandwich attacks: trading around someone else’s swap",
  "description": "Understand how transaction ordering around a swap can worsen a trader’s execution, and distinguish minimum-output protection from a guarantee against all MEV.",
  "aliases": [],
  "dates": {
    "published": "2026-10-02",
    "modified": "2026-10-02",
    "verified": "2026-10-02T18:15:18.493Z",
    "dataAsOf": "2026-10-02"
  },
  "authorship": {
    "publisher": "Degrees of Satoshi editorial project",
    "process": "AI-assisted research and drafting with a separate automated source-verification pass; no external expert or named human review is implied."
  },
  "quickAnswer": {
    "text": "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.",
    "claimId": "sandwich-attacks-quick-answer",
    "sourceIds": [
      "eth-mev",
      "uniswap-v2",
      "flashbots-protect"
    ]
  },
  "keyFacts": [
    {
      "label": "Ordering",
      "value": "The attack depends on arranging activity around the target transaction.",
      "sourceIds": [
        "eth-mev"
      ],
      "id": "ordering",
      "claimId": "sandwich-attacks-fact-ordering"
    },
    {
      "label": "Price effect",
      "value": "AMM reserve changes affect the next execution price.",
      "sourceIds": [
        "uniswap-v2"
      ],
      "id": "price-effect",
      "claimId": "sandwich-attacks-fact-price-effect"
    },
    {
      "label": "Limit",
      "value": "A minimum output constrains accepted execution, not the initial quote itself.",
      "sourceIds": [
        "uniswap-limit"
      ],
      "id": "limit",
      "claimId": "sandwich-attacks-fact-limit"
    }
  ],
  "prerequisites": [
    "maximal-extractable-value"
  ],
  "sections": [
    {
      "id": "sequence",
      "heading": "Follow the change in the pool’s state",
      "sourceIds": [
        "eth-mev",
        "uniswap-v2"
      ],
      "paragraphs": [
        "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."
      ]
    },
    {
      "id": "tolerance",
      "heading": "A loose limit can permit a worse fill",
      "sourceIds": [
        "uniswap-limit"
      ],
      "paragraphs": [
        "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."
      ]
    },
    {
      "id": "submission",
      "heading": "Reduce visibility with explicit trust assumptions",
      "sourceIds": [
        "flashbots-protect",
        "eth-mev"
      ],
      "paragraphs": [
        "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."
      ]
    }
  ],
  "faq": [
    {
      "question": "Is every change between quoted and executed output a sandwich attack?",
      "answer": "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.",
      "sourceIds": [
        "eth-mev",
        "uniswap-v2"
      ]
    }
  ],
  "claims": [
    {
      "id": "sandwich-attacks-quick-answer",
      "articleSlug": "sandwich-attacks",
      "statement": "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.",
      "sourceIds": [
        "source-b9c1aef903b1d75a",
        "source-9d6f5c70415da83e",
        "source-f3d456a5988db888"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-b9c1aef903b1d75a",
          "locator": "Sandwich trading; MEV protection"
        },
        {
          "sourceId": "source-9d6f5c70415da83e",
          "locator": "Price oracle; Liquidity; Fees"
        },
        {
          "sourceId": "source-f3d456a5988db888",
          "locator": "MEV protection; Privacy; How it works"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Read Ethereum MEV sandwich sequence, Uniswap v2 reserve-price mechanics, UniswapX signed output conditions and Flashbots Protect private-route scope.",
          "Attacker ordering, target execution bounds and ordinary intervening price movements are separated. Private submission is qualified by route behavior; no global protection or guaranteed attacker profitability is asserted."
        ]
      }
    },
    {
      "id": "sandwich-attacks-fact-ordering",
      "articleSlug": "sandwich-attacks",
      "statement": "Ordering: The attack depends on arranging activity around the target transaction.",
      "sourceIds": [
        "source-b9c1aef903b1d75a"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-b9c1aef903b1d75a",
          "locator": "Sandwich trading; MEV protection"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Read Ethereum MEV sandwich sequence, Uniswap v2 reserve-price mechanics, UniswapX signed output conditions and Flashbots Protect private-route scope.",
          "Attacker ordering, target execution bounds and ordinary intervening price movements are separated. Private submission is qualified by route behavior; no global protection or guaranteed attacker profitability is asserted."
        ]
      }
    },
    {
      "id": "sandwich-attacks-fact-price-effect",
      "articleSlug": "sandwich-attacks",
      "statement": "Price effect: AMM reserve changes affect the next execution price.",
      "sourceIds": [
        "source-9d6f5c70415da83e"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-9d6f5c70415da83e",
          "locator": "Price oracle; Liquidity; Fees"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Read Ethereum MEV sandwich sequence, Uniswap v2 reserve-price mechanics, UniswapX signed output conditions and Flashbots Protect private-route scope.",
          "Attacker ordering, target execution bounds and ordinary intervening price movements are separated. Private submission is qualified by route behavior; no global protection or guaranteed attacker profitability is asserted."
        ]
      }
    },
    {
      "id": "sandwich-attacks-fact-limit",
      "articleSlug": "sandwich-attacks",
      "statement": "Limit: A minimum output constrains accepted execution, not the initial quote itself.",
      "sourceIds": [
        "source-2ffecd3d628a4d03"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-2ffecd3d628a4d03",
          "locator": "Signed orders; Fillers; Dutch auctions"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:15:18.493Z",
        "reviewer": "automated independent verification — DeFi expansion reviewer",
        "notes": [
          "Read Ethereum MEV sandwich sequence, Uniswap v2 reserve-price mechanics, UniswapX signed output conditions and Flashbots Protect private-route scope.",
          "Attacker ordering, target execution bounds and ordinary intervening price movements are separated. Private submission is qualified by route behavior; no global protection or guaranteed attacker profitability is asserted."
        ]
      }
    }
  ],
  "sources": [
    {
      "id": "eth-mev",
      "label": "Maximal extractable value",
      "publisher": "ethereum.org contributors",
      "url": "https://ethereum.org/en/developers/docs/mev/",
      "locator": "Sandwich trading; MEV protection",
      "note": "Ordering-dependent extraction and limits of private submission.",
      "version": null,
      "checkedAt": "2026-10-02T17:03:45.625Z",
      "contentSha256": "5cae47952034f725ecaf04ec7c7c6638287a34ada1a5df2696ab9f346950bad7",
      "recordId": "source-b9c1aef903b1d75a"
    },
    {
      "id": "uniswap-v2",
      "label": "Uniswap v2 whitepaper",
      "publisher": "Uniswap",
      "url": "https://app.uniswap.org/whitepaper.pdf",
      "locator": "Price oracle; Liquidity; Fees",
      "note": "Full-range constant-product inventory and cumulative-price oracle design.",
      "version": "Uniswap v2 whitepaper, March 2020",
      "checkedAt": "2026-10-02T17:03:45.008Z",
      "contentSha256": "32f8efd517767d8effb908e322df5ed1fe746ad0a3e642d49596cf2de1a6d21d",
      "recordId": "source-9d6f5c70415da83e"
    },
    {
      "id": "flashbots-protect",
      "label": "Flashbots Protect overview",
      "publisher": "Flashbots",
      "url": "https://docs.flashbots.net/flashbots-protect/overview",
      "locator": "MEV protection; Privacy; How it works",
      "note": "Private submission changes who receives a transaction and depends on relay and builder behavior.",
      "version": null,
      "checkedAt": "2026-10-02T17:03:45.401Z",
      "contentSha256": "704ca49b36e9ec52864ddc16622657bdb144ae52e30735e17f4e45c242afb638",
      "recordId": "source-f3d456a5988db888"
    },
    {
      "id": "uniswap-limit",
      "label": "UniswapX overview",
      "publisher": "Uniswap",
      "url": "https://docs.uniswap.org/contracts/uniswapx/overview",
      "locator": "Signed orders; Fillers; Dutch auctions",
      "note": "Signed order execution through fillers; execution conditions are mechanism-specific.",
      "version": null,
      "checkedAt": "2026-10-02T17:21:47.712Z",
      "contentSha256": "6a3ba9665629f01f100ebd0f2e4ec09713bcc8d1d5acd4c5b12e511e3d4ff56f",
      "recordId": "source-2ffecd3d628a4d03"
    }
  ],
  "related": {
    "articles": [
      "private-transaction-submission",
      "slippage-and-price-impact",
      "swap-routing-and-aggregators"
    ],
    "dossiers": [],
    "wallets": []
  },
  "revisionHistory": [
    {
      "date": "2026-10-02",
      "kind": "published",
      "summary": "First publication after primary-source research and independent automated verification."
    }
  ],
  "citation": "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/"
}
