An exact-output quote begins with the required final receipt and works backward to determine what each earlier stage must supply. The economic flow still exchanges the original input for the final asset; the reverse calculation discovers the necessary amounts.
Start at the destination
Suppose a hypothetical route is A-to-C-to-B and the user needs exactly 100 B. The C/B pool's quote says that obtaining 100 B requires 42 C. The router then asks the A/C pool how much A is needed to obtain those 42 C.
If that answer is 21 A, the path's estimated input is 21 A, subject to its actual fee rules and execution state. The router can compare this with other paths by repeating the backward requirement calculation.
Why forward guessing is awkward
A forward quote answers a different question: how much output does a chosen input produce? Guessing 20 A and receiving 96 B misses the target. Increasing the guess can work numerically, but a direct exact-output calculation expresses the user's constraint more naturally.
Uniswap's v3 multi-hop documentation describes reverse path encoding for its exact-output execution. That encoding is implementation-specific; the general reasoning is that downstream requirements determine upstream amounts.
Reverse calculation is not reverse ownership
The user does not need to already own B or C simply because the calculation starts with B. Contract execution can coordinate transfers and callbacks according to the protocol's rules. The final result remains an A expense and a B receipt.
Bound the required input
The user normally supplies a maximum input. If the live route requires more than that ceiling, the trade cannot satisfy the request. The earlier estimate of 21 A is not an authorization to spend without limit.
Some routes or token types may not support exact-output behavior in a particular implementation. Confirm support before treating a target receipt as guaranteed. The routing mathematics, execution capability and final delivery conditions must all agree.
Sources & verification (2)
Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.
- Multi-hop Swapping
Sequential token paths and reverse requirements for exact-output swaps.
https://developers.uniswap.org/docs/protocols/v3/guides/swapping/multi-hop-swapping - Single Swaps | Uniswap Developers
Exact-input and exact-output swap modes and their bounds.
https://developers.uniswap.org/docs/protocols/v3/guides/swapping/single-hop-swapping