{
  "$schema": "https://degreesofsatoshi.com/encyclopedia/schemas/article-v1.json",
  "schemaVersion": "1.0.0",
  "id": "decentralized-exchanges",
  "canonical": "https://degreesofsatoshi.com/encyclopedia/decentralized-exchanges/",
  "collection": "defi",
  "title": "Decentralized exchanges: how a token trade reaches settlement",
  "description": "See how decentralized exchanges quote and settle trades, why an interface differs from its contracts, and which limits a swap transaction enforces.",
  "aliases": [
    "DEX",
    "decentralised exchange"
  ],
  "dates": {
    "published": "2026-10-02",
    "modified": "2026-10-02",
    "verified": "2026-10-02T18:17:57.897Z",
    "dataAsOf": null
  },
  "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 decentralized exchange uses blockchain contracts to settle trades. In an automated-market-maker design, a trader exchanges assets against pool inventory; other designs use signed orders filled by competing third parties. A quote is an estimate until execution, and the submitted limits determine which outcomes the contract may accept.",
    "claimId": "decentralized-exchanges-quick-answer",
    "sourceIds": [
      "defi",
      "pricing",
      "uniswapx"
    ]
  },
  "keyFacts": [
    {
      "label": "Pool design",
      "value": "Uniswap v2 checks a fee-adjusted reserve invariant.",
      "sourceIds": [
        "pair"
      ],
      "id": "pool-design",
      "claimId": "decentralized-exchanges-fact-pool-design"
    },
    {
      "label": "Quote",
      "value": "Input, reserves and fees determine an estimated output.",
      "sourceIds": [
        "pricing"
      ],
      "id": "quote",
      "claimId": "decentralized-exchanges-fact-quote"
    },
    {
      "label": "Trade bound",
      "value": "A minimum output can reject an unfavorable execution.",
      "sourceIds": [
        "pricing"
      ],
      "id": "trade-bound",
      "claimId": "decentralized-exchanges-fact-trade-bound"
    }
  ],
  "prerequisites": [
    "what-is-defi",
    "connecting-a-wallet"
  ],
  "sections": [
    {
      "id": "quote",
      "heading": "A quote describes state before the execution happens",
      "paragraphs": [
        "A pool quote uses current reserves and fees; an order quote follows its signed conditions and available execution route. Other trades or state changes can occur before the user’s transaction is included.",
        "The contract accepts or rejects the actual execution according to its limits. Compare the received amount with the quote at its recorded time, and separate the trade’s own price impact from intervening changes. A wallet signature or a submitted hash alone is not a completed swap."
      ],
      "sourceIds": [
        "edition-uniswap-v2",
        "edition-uniswap-limit"
      ]
    },
    {
      "id": "example",
      "heading": "Read the limits in a sample trade",
      "paragraphs": [
        "Suppose a quote offers 100 B for 10 A and the submitted minimum is 99 B. A result of 99.4 B meets that minimum; 98.9 B does not. This boundary does not promise a particular market price, and an included Ethereum transaction that reverts still consumes gas used before failure. Who pays depends on the submission design; the UniswapX announcement of July 17, 2023 describes fillers paying to submit signed orders.",
        "A displayed rate also needs a denominator. Output per input, output after pool fees, gas paid in the network asset and any separate interface fee are different quantities. Comparing a headline quote without those distinctions can compare unlike costs."
      ],
      "sourceIds": [
        "pricing",
        "revert",
        "uniswapx"
      ]
    },
    {
      "id": "scope",
      "heading": "A DEX name is not a token endorsement",
      "paragraphs": [
        "A permissionless pool can contain a token with unusual transfer rules, an issuer freeze mechanism or no credible backing. Pool existence is evidence of a contract and balances, not evidence that the asset is useful or redeemable.",
        "Identify the actual chain, token contract, pool version and route. This article’s invariant example is Uniswap v2, not a claim that every exchange uses the same pricing, custody or administrative design."
      ],
      "sourceIds": [
        "defi",
        "pair"
      ]
    }
  ],
  "faq": [
    {
      "question": "Can a swap fail after I approve it?",
      "answer": "Yes. State can change before execution, or the trade can violate a minimum output or another contract condition. Approval to spend tokens does not guarantee that a later swap succeeds.",
      "sourceIds": [
        "pricing"
      ]
    }
  ],
  "claims": [
    {
      "id": "decentralized-exchanges-quick-answer",
      "articleSlug": "decentralized-exchanges",
      "statement": "A decentralized exchange uses blockchain contracts to settle trades. In an automated-market-maker design, a trader exchanges assets against pool inventory; other designs use signed orders filled by competing third parties. A quote is an estimate until execution, and the submitted limits determine which outcomes the contract may accept.",
      "sourceIds": [
        "source-6bc833104d3a27ba",
        "source-5cf943a6c62eb740",
        "source-9b0271b32c669dd2"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-6bc833104d3a27ba",
          "locator": "What is DeFi?; How does DeFi work?"
        },
        {
          "sourceId": "source-5cf943a6c62eb740",
          "locator": "Pricing Trades; Exact Input; Exact Output"
        },
        {
          "sourceId": "source-9b0271b32c669dd2",
          "locator": "Next-level aggregation; Gas-free swapping — and no cost for failed swaps"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": null,
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:17:57.897Z",
        "reviewer": "automated independent verification — DeFi content-pass reviewer",
        "notes": [
          "Reopened Uniswap v2 white paper, pricing documentation, v2 Pair code, UniswapX overview and original announcement. Verified reserve/fee quoting, signed output conditions and separate submission/settlement states.",
          "Compared the edited quote section with the existing minimum-output example and filler-paid UniswapX gas caveat. 99.4 satisfies a 99-unit bound and 98.9 does not. No contradiction or unsupported guaranteed fill found."
        ]
      }
    },
    {
      "id": "decentralized-exchanges-fact-pool-design",
      "articleSlug": "decentralized-exchanges",
      "statement": "Pool design: Uniswap v2 checks a fee-adjusted reserve invariant.",
      "sourceIds": [
        "source-5651ae58cdcb25c2"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-5651ae58cdcb25c2",
          "locator": "mint; burn; swap; _mintFee"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": null,
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:17:57.897Z",
        "reviewer": "automated independent verification — DeFi content-pass reviewer",
        "notes": [
          "Reopened Uniswap v2 white paper, pricing documentation, v2 Pair code, UniswapX overview and original announcement. Verified reserve/fee quoting, signed output conditions and separate submission/settlement states.",
          "Compared the edited quote section with the existing minimum-output example and filler-paid UniswapX gas caveat. 99.4 satisfies a 99-unit bound and 98.9 does not. No contradiction or unsupported guaranteed fill found."
        ]
      }
    },
    {
      "id": "decentralized-exchanges-fact-quote",
      "articleSlug": "decentralized-exchanges",
      "statement": "Quote: Input, reserves and fees determine an estimated output.",
      "sourceIds": [
        "source-5cf943a6c62eb740"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-5cf943a6c62eb740",
          "locator": "Pricing Trades; Exact Input; Exact Output"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": null,
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:17:57.897Z",
        "reviewer": "automated independent verification — DeFi content-pass reviewer",
        "notes": [
          "Reopened Uniswap v2 white paper, pricing documentation, v2 Pair code, UniswapX overview and original announcement. Verified reserve/fee quoting, signed output conditions and separate submission/settlement states.",
          "Compared the edited quote section with the existing minimum-output example and filler-paid UniswapX gas caveat. 99.4 satisfies a 99-unit bound and 98.9 does not. No contradiction or unsupported guaranteed fill found."
        ]
      }
    },
    {
      "id": "decentralized-exchanges-fact-trade-bound",
      "articleSlug": "decentralized-exchanges",
      "statement": "Trade bound: A minimum output can reject an unfavorable execution.",
      "sourceIds": [
        "source-5cf943a6c62eb740"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-5cf943a6c62eb740",
          "locator": "Pricing Trades; Exact Input; Exact Output"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": null,
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T18:17:57.897Z",
        "reviewer": "automated independent verification — DeFi content-pass reviewer",
        "notes": [
          "Reopened Uniswap v2 white paper, pricing documentation, v2 Pair code, UniswapX overview and original announcement. Verified reserve/fee quoting, signed output conditions and separate submission/settlement states.",
          "Compared the edited quote section with the existing minimum-output example and filler-paid UniswapX gas caveat. 99.4 satisfies a 99-unit bound and 98.9 does not. No contradiction or unsupported guaranteed fill found."
        ]
      }
    }
  ],
  "sources": [
    {
      "id": "defi",
      "label": "Ethereum DeFi overview",
      "publisher": "ethereum.org contributors",
      "url": "https://ethereum.org/defi/",
      "locator": "What is DeFi?; How does DeFi work?",
      "note": "Financial applications and the distinction between blockchain, assets, protocols and interfaces.",
      "version": null,
      "checkedAt": "2026-10-02",
      "recordId": "source-6bc833104d3a27ba",
      "contentSha256": null
    },
    {
      "id": "pricing",
      "label": "Uniswap v2 pricing",
      "publisher": "Uniswap",
      "url": "https://developers.uniswap.org/docs/protocols/v2/concepts/pricing",
      "locator": "Pricing Trades; Exact Input; Exact Output",
      "note": "Reserve-dependent quotes, trade bounds and external price observations.",
      "version": "Uniswap v2",
      "checkedAt": "2026-10-02",
      "recordId": "source-5cf943a6c62eb740",
      "contentSha256": null
    },
    {
      "id": "pair",
      "label": "Uniswap v2 pair source",
      "publisher": "Uniswap",
      "url": "https://raw.githubusercontent.com/Uniswap/v2-core/v1.0.1/contracts/UniswapV2Pair.sol",
      "locator": "mint; burn; swap; _mintFee",
      "note": "Reserve accounting, LP shares, fee-adjusted invariant and optional protocol fee.",
      "version": "v2-core v1.0.1",
      "checkedAt": "2026-10-02",
      "recordId": "source-5651ae58cdcb25c2",
      "contentSha256": null
    },
    {
      "id": "uniswapx",
      "label": "Introducing the UniswapX Protocol",
      "publisher": "Uniswap Labs",
      "url": "https://blog.uniswap.org/uniswapx-protocol",
      "locator": "Next-level aggregation; Gas-free swapping — and no cost for failed swaps",
      "note": "Dated example of signed orders filled and submitted by competing third parties.",
      "version": "2023-07-17 announcement",
      "checkedAt": "2026-10-02",
      "recordId": "source-9b0271b32c669dd2",
      "contentSha256": null
    },
    {
      "id": "revert",
      "label": "EIP-140: REVERT instruction",
      "publisher": "Ethereum Improvement Proposals",
      "url": "https://eips.ethereum.org/EIPS/eip-140",
      "locator": "Specification; Test Cases",
      "note": "Reverting rolls back state but does not refund work already executed; unused gas is not all consumed.",
      "version": "EIP-140 final",
      "checkedAt": "2026-10-02",
      "recordId": "source-ccab9c4be966af8f",
      "contentSha256": null
    },
    {
      "id": "edition-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": "edition-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": [
      "automated-market-makers",
      "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."
    },
    {
      "date": "2026-10-02",
      "kind": "prepublication-review",
      "summary": "Before first publication, independent review checked and revised: quickAnswer, quickAnswerSourceIds, sections, sources. Compared the v2 pair invariant and pricing guide with the July 17, 2023 UniswapX announcement. Added primary support for signed-order settlement by competing fillers; no claim that all DEXs use one design. Checked the 100/99 output-bound example. Added EIP-140 support and distinguished included-failure gas from who pays under a filler submission design."
    },
    {
      "date": "2026-10-02",
      "kind": "substantive-edit",
      "summary": "Expanded explanation: A quote describes state before the execution happens. Worked examples are illustrative; source checks and independent verification are recorded separately."
    }
  ],
  "citation": "Degrees of Satoshi editorial project. “Decentralized exchanges: how a token trade reaches settlement.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/decentralized-exchanges/"
}
