JIT Routing (Just-in-Time Routing) is DFlow’s onchain routing mechanism that updates trade routes at execution time to find the best possible prices. Traditional Solana aggregators compute routes offchain and embed a fixed path into the transaction. Once signed, that route cannot change. If prices move before execution, the transaction either executes or fails due to slippage limits. JIT Routing moves part of the routing decision onchain. The swap transaction contains conditional logic that allows the router to select between liquidity sources during execution, based on current onchain prices.Documentation Index
Fetch the complete documentation index at: https://pond.dflow.net/llms.txt
Use this file to discover all available pages before exploring further.
When JIT Routing Is Used
JIT routing engages automatically when the router determines it is optimal.Execution Flow
- Quote time (offchain)
- DFlow computes an optimal route using current market data.
- The route may include prop AMMs and fallback venues.
- Transaction construction
- The transaction embeds conditional instructions.
- These instructions allow branching between liquidity sources.
- Execution time (onchain)
- Before executing, the program checks the current onchain price.
- If the price is within acceptable bounds, the original leg is executed.
- If the price has moved beyond a threshold, the router switches to an alternative venue.
- All decisions occur within the same transaction.
Key Properties
- Onchain decision making Routing decisions are made by the program during execution, not by offchain infrastructure.
- Single transaction Rerouting does not require resubmission or multiple transactions.
- Deterministic constraints All possible branches are known and encoded at transaction construction time.
- No user interaction changes Users still request a quote and sign a transaction as usual.
Benefits for Builders
- Lower realized slippage Execution reflects current prices instead of stale quotes.
- Higher success rates Fewer transactions fail due to price movement exceeding slippage tolerance.
- Reduced need for wide slippage limits Less exposure to adverse execution caused by conservative slippage settings.
Comparison to Static Routing
| Aspect | Static Routing | JIT Routing |
|---|---|---|
| Route selection | Offchain, fixed | Onchain, conditional |
| Reaction to price changes | None | Immediate |
| Failure risk in fast markets | High | Lower |
Availability
JIT Routing is enabled automatically for eligible routes when using the DFlow Trading API. No additional parameters are required from builders.Need Help?
Join Our Discord
Connect with other developers, get help, and stay updated on the latest
DFlow developments.
Dev Notifications
Join the DFlow Dev Notifications Telegram group to stay in the loop on
new features and other announcements.