Jupiterexchange

Jupiterexchange routing selects swap paths within liquidity and transaction constraints

last updated

Jupiterexchange routing chooses a swap path by comparing token output across compatible sources of Solana liquidity. A path can divide an order across pools or use intermediate tokens when those combinations improve the exchange. The available routing engines also depend on the chosen integration and its settings. Execution-time adjustments can change a quoted allocation within supported candidates. Comparing paths therefore means holding the input amount constant while accounting for the liquidity, fees, and transaction requirements that shape each quote.

Engines connect market quotes with swap paths

The Meta-Aggregator compares routing engines, while Metis constructs paths through its supported liquidity. Swap V2 lets Metis, JupiterZ, DFlow, and OKX compete when request settings permit them. Metis supports split and multi-hop routing across Solana decentralized exchanges, or DEXes. Standalone JupiterZ requests quotes from market makers. DFlow contributes a third-party on-chain router, and OKX contributes its liquidity integration. The winning engine identifies the system that supplied a quote, while the route describes the operations inside its swap path.

Transaction control sets the routing boundary

The Swap V2 Meta-Aggregator suits integrations that can accept an assembled transaction and leave execution handling to Jupiter. Its /order response can supply a quote and assembled transaction, while /execute handles the signed order. Competition occurs among the eligible engines. Their availability still depends on the parameters that the integration sends, so the same token selection does not imply identical routing coverage.

Custom instructions require a different integration choice. The Router path returns raw instructions through /build and uses Metis for routing. It supports transaction composition and cross-program invocation, which lets another on-chain program call the swap program. The integration must assemble compatible instructions and account for the compute resources that the complete transaction needs. Swap V2 /build replaces the deprecated Metis Swap V1 API’s separate quote-and-instructions flow.

Default Meta-Aggregator quotes include Jupiter’s platform fee. An active referral fee replaces the separate platform fee. Jupiter charges no swap fee on /build. Integrator fees and network costs remain separate considerations.

Gas sponsorship can also change eligibility. Setting payer to a wallet different from taker restricts Swap V2 /order to Metis. Integrator-sponsored /order swaps use referralAccount and referralFee alongside payer and require both taker and payer signatures. Automatic sponsorship is a separate mechanism, so the gasless flag alone does not identify which engines were eligible. A change in fee payer can therefore change the quoted path.

Venue filters and engine filters operate at different levels. On /order, excludeDexes affects Metis, while excludeRouters removes top-level engines. On /build, dexes restricts routing to specified DEXes. An exclusion applied only to Metis does not establish a venue restriction across every competing engine.

Transaction control sets the routing boundary (Jupiterexchange routing) - diagram
Transaction control sets the routing boundary.

Open full-size image

Liquidity depth shapes splits and intermediate hops

Liquidity depth affects the output available for a particular input amount, while pool prices determine which paths compete. A direct path exchanges the input for the output without an intermediate token. A multi-hop path uses an intermediate token, and a split distributes parts of the order across different paths. These dimensions can coexist within Metis. Splitting can avoid concentrating the whole order in one shallow pool. Changing trade size can change both the useful paths and their allocations, because each leg contributes its own exchange conditions.

The routing graph also includes supported operations beyond ordinary pool trades. Metis can use Jupiter Lend mint and redeem operations to connect yield positions in one atomic transaction. A mint or redemption leg therefore represents a different operation from exchanging assets through a pool. Routing support for these operations extends the possible path; the selected assets still need compatible integrations.

Can the quoted route change during execution?

JIT Swap can change a swap’s pool allocation by re-quoting the candidate pools carried in its transaction at execution. The off-chain router supplies those candidates and an initial distribution. The on-chain program compares alternatives using the pool states that it encounters. Its adjustment stays within that candidate set, so the transaction cannot search every Solana market afresh. This mechanism applies to swaps using JIT Swap; it does not describe every routing mode.

Account space and compute usage limit how many candidates can accompany a swap. Execution must still satisfy the transaction’s output protection and other requirements. The quoted route, a permitted allocation change, and the final token movements describe different states. Slippage tolerance bounds acceptable execution; it does not create more liquidity or expand the candidate set.

Account space competes with routing flexibility

Transaction space limits which routes can fit beside custom instructions, so reducing account usage can remove otherwise attractive paths. The Swap V2 /build parameter maxAccounts accepts a route budget from 1 to 64 accounts. The budget covers the swap route; custom instructions can introduce further account requirements. Tighter values can weaken the quote or leave no compatible route.

Byte capacity also depends on the transaction format. Solana v0 allows 1,232 bytes; v1 allows 4,096 bytes. Both formats retain account constraints. Using v1 requires compatible signing software. On /build, request transactionVersion=1 and set the compute unit and loaded account data size limits on the message configuration. On /order, maxSupportedTransactionVersion=1 permits v1 only when Metis wins and the order is not gasless; other assembled transactions use v0. Read the returned transactionVersion before signing. A larger envelope can relieve a size constraint while leaving account and liquidity limits in place.

For a custom swap that needs room for required instructions, keep the selected token mints and input amount fixed. Change the route’s account budget only after checking whether unnecessary setup instructions consume the available space.

  • If the required associated token accounts already exist, omit their redundant idempotent creation instructions.
  • If account space remains insufficient, lower maxAccounts slightly and request a fresh quote.
  • Compare the new route and expected output with the earlier quote; moving markets can also change the estimate.
  • Keep the candidate only if the complete transaction fits, simulates successfully, and meets the chosen output requirement.
  • If no route accommodates mandatory instructions, stop before signing; if those instructions are optional, compare a fresh assembled-order quote.

Simulation checks the transaction against the state that it evaluates. It does not reserve liquidity or fix the output of a future swap.

Visual summary: Jupiterexchange routing - Account space competes with routing flexibility

Open full-size image

Fast mode trades splitting for quote latency

Fast mode on the Swap V2 Router path reduces quote latency by searching without splitting across multiple pools. The setting mode=fast remains a beta feature. It uses Bellman-Ford routing and runs priority-fee lookup in parallel with the route search. Because the writable route accounts are not yet known during that lookup, the estimate uses global fee conditions. Default routing considers splitting; fast mode can miss combinations that improve output, particularly where liquidity depth varies between pools.

Visual summary: Fast mode trades splitting for quote latency (Jupiterexchange routing)

Open full-size image

Pool hops and market-maker fills have different conditions

Market-maker liquidity enters Jupiter through different integrations, and the version determines how it participates in a route. In JupiterZ V1, market makers answer individual quote requests for the standalone JupiterZ engine. In JupiterZ V2, market makers stream order-book snapshots for Metis to quote from. Both models run concurrently. Metis can incorporate a market-maker fill as a hop, so a Metis route can contain liquidity beyond pool trades.

RFQ means request for quote. In the V2 streaming model, snapshots carry expiry information, and stale prices drop out of the cache. Quotes require available maker inventory and a live swap stream. The maker validates and co-signs the proposed fill under last-look rules. A competitive quote still depends on that maker accepting the fill. In V2, missing the enforced signing deadline expires the swap without a fallback to the next quote. Pool legs elsewhere in a mixed route retain their own execution conditions.

Practical questions about Jupiterexchange routing

Can a routing quote show an output amount without a usable transaction?

A Swap V2 order can contain pricing even when it cannot provide a transaction that can execute. Without taker, the response contains a quote but no transaction. With taker present, an empty transaction string indicates a build failure. The router and errorCode fields identify the applicable error; quoted output alone does not establish readiness.

Does a referral fee exclude JupiterZ from the competing routers?

A referral fee does not by itself remove JupiterZ from Swap V2 Meta-Aggregator competition. The referralAccount and referralFee parameters preserve eligibility across the listed engines. Other parameters can change that coverage, including a payer different from taker. Eligibility permits an engine to compete; it does not mean that engine will supply the winning quote.

When can the Meta-Aggregator quote a token that Metis cannot route?

The Meta-Aggregator can return a quote through another eligible engine when Metis has no available path. Metis removes markets that fail its applicable liquidity checks, while JupiterZ, DFlow, or OKX may still supply a quote. Availability through one integration therefore does not establish that the same token exchange is routable through the Metis-only Router path.

Is a DEX restriction case-sensitive in the routing API?

DEX labels in Swap V2 Router filters are case-sensitive. An unrecognized label in dexes can produce a no-route response, which can resemble a genuine liquidity shortage. The dexes and excludeDexes parameters are mutually exclusive on build requests. A filter spelling error therefore needs a different correction from an order that lacks compatible liquidity.

What does the manual mode label reveal about the winning router?

The manual mode label indicates that an order used custom request parameters. Swap V2 reports the winning engine separately in router. The parameters can alter eligibility or execution settings, so identical mode labels can accompany different engines and different routes.

How should route weights be read after migrating to Swap V2?

Swap V2 uses bps as the canonical route-weight field, while retaining percent for backward compatibility. Basis points represent hundredths of a percentage point, so a full allocation is 10,000 basis points. Legacy percent-based parsing needs adjustment to avoid reading the larger numeric scale as a larger trade allocation.