{
  "$schema": "https://degreesofsatoshi.com/encyclopedia/schemas/article-v1.json",
  "schemaVersion": "1.0.0",
  "id": "exact-input-vs-exact-output-swaps",
  "canonical": "https://degreesofsatoshi.com/encyclopedia/exact-input-vs-exact-output-swaps/",
  "collection": "defi",
  "title": "Exact-input and exact-output swaps: which amount is fixed?",
  "description": "Compare a fixed spending amount with a fixed receiving amount, including the transaction bounds and treatment of unused input.",
  "aliases": [
    "swap exact input vs exact output",
    "minimum output versus maximum input"
  ],
  "dates": {
    "published": "2026-10-02",
    "modified": "2026-10-02",
    "verified": "2026-10-02T19:18:00.092Z",
    "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": "An exact-input swap fixes the amount offered and enforces a minimum received. An exact-output swap targets a receiving amount and enforces a maximum spent. In the documented Uniswap v3 router flows, a trade that cannot satisfy its bound fails; the displayed quote is not a promise of execution.",
    "claimId": "exact-input-vs-exact-output-swaps-quick-answer",
    "sourceIds": [
      "x425-defi-uni-swaps"
    ]
  },
  "keyFacts": [
    {
      "label": "Exact input",
      "value": "The usual protection is amountOutMinimum.",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "id": "exact-input",
      "claimId": "exact-input-vs-exact-output-swaps-fact-exact-input"
    },
    {
      "label": "Exact output",
      "value": "The input is limited by amountInMaximum.",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "id": "exact-output",
      "claimId": "exact-input-vs-exact-output-swaps-fact-exact-output"
    },
    {
      "label": "Unused input",
      "value": "A prefunded exact-output integration must return any unspent input.",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "id": "unused-input",
      "claimId": "exact-input-vs-exact-output-swaps-fact-unused-input"
    }
  ],
  "prerequisites": [
    "slippage-and-price-impact"
  ],
  "sections": [
    {
      "id": "budget",
      "heading": "Choose which side matters",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "paragraphs": [
        "A person spending a fixed 100 units of token A generally cares about the token B amount received. A person who needs exactly 50 B generally cares about how much A must be supplied. Those are different transaction instructions even when an interface initially quotes the same exchange rate."
      ]
    },
    {
      "id": "example",
      "heading": "Read the actual bounds",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "paragraphs": [
        "Suppose spending 100 A is quoted to receive 50 B. A 1% reduction from that quote gives a minimum of 49.5 B. A different instruction might request exactly 50 B while allowing at most 101 A. Neither instruction requires execution at the original quote.",
        "The arithmetic is hypothetical and states the percentage convention explicitly. Interfaces can calculate tolerances differently. Inspect the minimum-output or maximum-input amount that will actually be enforced, along with the recipient and deadline."
      ]
    },
    {
      "id": "edge",
      "heading": "Account for the integration",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ],
      "paragraphs": [
        "In Uniswap’s example, the exact-output helper temporarily takes the maximum input and refunds the unused portion. A custom integration needs to implement that refund correctly. A nonzero price limit can also cause an exact-input flow to use less than the requested amount, requiring careful refund handling.",
        "These are v3 router examples. Fee-on-transfer tokens, custom hooks and other routers can have different supported behavior; a familiar swap label does not establish compatibility."
      ]
    }
  ],
  "faq": [
    {
      "question": "Does exact output guarantee that I will receive the target?",
      "answer": "In the documented router example with sqrtPriceLimitX96 set to zero, a successful exact-output swap delivers the requested output. Liquidity, input limits or expiry can still prevent settlement. Custom nonzero price-limit paths need their own output-completeness checks.",
      "sourceIds": [
        "x425-defi-uni-swaps"
      ]
    }
  ],
  "claims": [
    {
      "id": "exact-input-vs-exact-output-swaps-quick-answer",
      "articleSlug": "exact-input-vs-exact-output-swaps",
      "statement": "An exact-input swap fixes the amount offered and enforces a minimum received. An exact-output swap targets a receiving amount and enforces a maximum spent. In the documented Uniswap v3 router flows, a trade that cannot satisfy its bound fails; the displayed quote is not a promise of execution.",
      "sourceIds": [
        "source-30ee786187b1a90d"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-30ee786187b1a90d",
          "locator": "exactInputSingle; exactOutputSingle; deadline; amountOutMinimum; amountInMaximum"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked exact-input and exact-output bounds against Uniswap v3 single-swap tutorial; 50 × 0.99 = 49.5. Requested explicit zero-price-limit scope for exact-output completeness."
        ]
      }
    },
    {
      "id": "exact-input-vs-exact-output-swaps-fact-exact-input",
      "articleSlug": "exact-input-vs-exact-output-swaps",
      "statement": "Exact input: The usual protection is amountOutMinimum.",
      "sourceIds": [
        "source-30ee786187b1a90d"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-30ee786187b1a90d",
          "locator": "exactInputSingle; exactOutputSingle; deadline; amountOutMinimum; amountInMaximum"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked exact-input and exact-output bounds against Uniswap v3 single-swap tutorial; 50 × 0.99 = 49.5. Requested explicit zero-price-limit scope for exact-output completeness."
        ]
      }
    },
    {
      "id": "exact-input-vs-exact-output-swaps-fact-exact-output",
      "articleSlug": "exact-input-vs-exact-output-swaps",
      "statement": "Exact output: The input is limited by amountInMaximum.",
      "sourceIds": [
        "source-30ee786187b1a90d"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-30ee786187b1a90d",
          "locator": "exactInputSingle; exactOutputSingle; deadline; amountOutMinimum; amountInMaximum"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked exact-input and exact-output bounds against Uniswap v3 single-swap tutorial; 50 × 0.99 = 49.5. Requested explicit zero-price-limit scope for exact-output completeness."
        ]
      }
    },
    {
      "id": "exact-input-vs-exact-output-swaps-fact-unused-input",
      "articleSlug": "exact-input-vs-exact-output-swaps",
      "statement": "Unused input: A prefunded exact-output integration must return any unspent input.",
      "sourceIds": [
        "source-30ee786187b1a90d"
      ],
      "sourceLocators": [
        {
          "sourceId": "source-30ee786187b1a90d",
          "locator": "exactInputSingle; exactOutputSingle; deadline; amountOutMinimum; amountInMaximum"
        }
      ],
      "scope": {
        "collection": "defi",
        "dataAsOf": "2026-10-02",
        "blockHeight": null
      },
      "qualification": "",
      "evidenceStatus": "documented",
      "verification": {
        "status": "verified",
        "method": "independent automated source review",
        "checkedAt": "2026-10-02T19:18:00.092Z",
        "reviewer": "Independent automated verification — Codex root, separate from the DeFi drafting agent",
        "notes": [
          "Checked exact-input and exact-output bounds against Uniswap v3 single-swap tutorial; 50 × 0.99 = 49.5. Requested explicit zero-price-limit scope for exact-output completeness."
        ]
      }
    }
  ],
  "sources": [
    {
      "id": "x425-defi-uni-swaps",
      "label": "Single Swaps",
      "publisher": "Uniswap",
      "url": "https://docs.uniswap.org/contracts/v3/guides/swaps/single-swaps",
      "locator": "exactInputSingle; exactOutputSingle; deadline; amountOutMinimum; amountInMaximum",
      "note": "Version-specific router constraints and worked integration examples.",
      "version": "Documentation retrieved for the 2026-10-02 editorial scope; content hash recorded",
      "checkedAt": "2026-10-02T18:53:19.662Z",
      "contentSha256": "34d9c27db51d7c364e5a5c0a8c93361d78a771368eec5079bea7fd709475489c",
      "recordId": "source-30ee786187b1a90d"
    }
  ],
  "related": {
    "articles": [
      "slippage-and-price-impact",
      "fee-on-transfer-tokens",
      "swap-deadlines-expired-quotes",
      "dex-swap-fee-breakdown"
    ],
    "dossiers": [],
    "wallets": []
  },
  "revisionHistory": [
    {
      "date": "2026-10-02",
      "kind": "published",
      "summary": "First publication after primary-source research and separate automated verification."
    }
  ],
  "citation": "Degrees of Satoshi editorial project. “Exact-input and exact-output swaps: which amount is fixed?.” Published 2026-10-02; updated 2026-10-02. https://degreesofsatoshi.com/encyclopedia/exact-input-vs-exact-output-swaps/"
}
