XRPL Auto-Bridging & Pathfinding
When you trade one token for another on the XRP Ledger and neither is XRP, the ledger tries two routes: straight from one token to the other, and through XRP in two steps. It fills from whichever pays you more, or from both. That is auto-bridging, and it is why a pair nobody quotes directly can still be traded. Right now, 100 RLUSD buys 1,933,058 FUZZY, routed through XRP.
A trade, through XRP
100 RLUSDyou pay
- XRPin between
1,933,058 FUZZYyou receive
What the ledger does
The rule is in the ledger’s own code. When an order crosses the book, the server “always” tries the default path, “however if neither of the takerAmount currencies are XRP then we cross through an additional path with XRP as the intermediate between two books” (OfferCreate.cpp). Both routes are offered to the same payment engine, which takes liquidity from the best prices first across both, and since 2024 from the AMM pools on each leg as well.
It happens on every order, with nothing for the trader to set and nothing extra to pay (xrpl.org).
Why it matters
Market makers only need to quote each token against XRP for every token to be tradable against every other. With 1,000 tokens each quoted against XRP, that is 1,000 markets to fill, yet 499,500 token-to-token pairs become tradable through them. A pair is only as deep as the shallower of its two XRP markets, though: two thin XRP books make a thin bridged pair.
Payments: paths
A Payment can convert on the way too, and it can go further than one bridge: it may carry up to 6 paths, each up to 8 steps, through other tokens, books and pools (Payment.h). The ledger does not search for them while it applies the payment. A server finds them beforehand, when a wallet or app asks it for paths, and the payment then names them (xrpl.org: Paths).
| Auto-bridging | Payment paths | |
|---|---|---|
| Used by | Orders (OfferCreate) | Payments that convert |
| Goes through | XRP only | Any token, book or pool |
| Who finds the route | The ledger, on every order | A server, when asked before sending |
| Length | Two books | Up to 6 paths of up to 8 steps |
The swap on xrpl.to and its quote API work out the route for you: direct, through XRP, or through another token’s pools, and name it in the quote, as in the example above.
Questions
- What is auto-bridging on the XRP Ledger?
- When an order trades one token for another and neither is XRP, the ledger also tries the trade in two steps through XRP, and fills from whichever route pays more, or from both.
- Does auto-bridging cost extra?
- No. The ledger charges no fee for it; the trade pays only the normal network fee. Any pool along the way charges its own trading fee, as it would on a direct trade.
- How many hops can an XRP Ledger payment take?
- A Payment can carry up to 6 paths, each up to 8 steps long. The ledger also always tries the direct path.