How does XRP Ledger pathfinding route payments?
Also asked as: “How many hops can an XRPL payment path use?” · “Is XRP routing built into the protocol?”
Confirmed Published 4 min read
Short answer
XRP Ledger pathfinding is a server search that proposes routes for a cross-currency payment through order books, AMM pools and trust lines, including routes through XRP. The ledger’s server code sets limits of 6 paths and 8 steps per path, checked September 29, 2026. XRPL.org says the search is not designed to find the absolute best path.
The full answer
What is a payment path?
A path is the route value takes from sender to receiver. XRPL.org says: “A path is made of steps that connect the sender to the receiver of the payment.” Each step is either “Rippling through another address with the same currency” or “Trading tokens or XRP using an order book or AMM.”[1] How AMM pools work is covered on how XRP Ledger AMMs work.
Every cross-currency payment has a default path: XRPL.org says “the default path uses the order book or AMM between the source currency (as specified in the SendMax field) and the destination currency,” meaning the direct market between the two.[1] Extra paths can be added, and “A single Payment transaction in the XRP Ledger can use multiple paths, combining liquidity from different sources to deliver the desired amount.”[1]
How many hops can a path use?
The limits sit in the server code. The Payment rules in the XRP Ledger server software set “The largest number of paths we allow” at 6 and “The longest path we allow” at 8 steps.[2] XRPL.org’s Paths and Payment pages, checked September 29, 2026, give no numeric limit.[1][4]
Who finds the path, and who checks it?
Finding and executing are separate jobs. A server finds candidate paths when asked, for example through its path_find method. XRPL.org says path_find “periodically sends updates when the path changes over time” and keeps updating “each time a new ledger closes.”[3] The sender then puts the chosen paths into a signed Payment, and the ledger executes it. A cross-currency payment “fully executes or no part of the payment executes at all.”[5]
XRP is one of the currencies a path can pass through. XRPL.org says token-to-token payments “can automatically use XRP to bridge the tokens, when it decreases the cost.”[5] Its auto-bridging page adds that payments “do not use auto-bridging by default, but path-finding can find paths that have the same effect.”[6] So routing through XRP is built into the protocol, but for payments it arrives through the path search. The order-book rule that does the same thing for trades is explained on what auto-bridging is, and how often the XRP route wins is on whether every payment goes through XRP.
Does pathfinding always find the cheapest route?
No, and XRPL.org says so. “Finding paths is a very challenging problem that changes slightly every few seconds as new ledgers are validated, so xrpld is not designed to find the absolute best path.”[1] The path_find reference adds: “it is not guaranteed that the paths returned by this method are, in fact, the best paths,” and “Due to server load, pathfinding may not find the best results.”[3]
Can price moves or front-running give pathfinding bad fills?
Both risks are documented.
Price movement. XRPL.org warns: “The actual cost to execute a payment along a path can change between submission and transaction execution.”[1] Trades execute only when a new ledger closes, “approximately every 3-5 seconds,” and XRPL.org says the ledger “is not suitable for high-frequency trading.” It also has no native market orders or stop orders, as the XRP Ledger does not natively represent concepts such as market orders, stop orders, or trading on leverage, according to xrpl.org.[7]
Untrusted servers. The path_find reference says “you should be careful with the pathfinding results from untrusted servers,” because “A server could be modified to return less-than-optimal paths to earn money for its operators.”[3]
Front-running (a company-reported claim and a news report; the page’s Confirmed label covers the pathfinding mechanics only). David Schwartz argued on RippleX Developers in June 2022 that the ledger resists it. He wrote that it “uses a shuffle algorithm to create a deterministic, pseudo-randomly ordered list of transactions, thus it is difficult for participants to front-run transactions.”[8] The counter-evidence comes from a news report that I could not confirm independently. 24/7 Wall St. reported that a 2023 study estimated front-runners could have taken about $1.4 million from XRP Ledger traders over two months, and that in June 2026 Schwartz himself proposed reserved trade slots so that booked trades run first. The report said the proposal was not yet a formal amendment.[9]
The sender’s own limits. The Payment transaction gives the sender controls. SendMax caps what can be spent. The tfLimitQuality flag limits a payment to paths “where all the conversions have an input:output ratio that is equal or better than the ratio of” Amount to SendMax. The tfNoRippleDirect flag skips the default path, and tfPartialPayment delivers less rather than spend more than SendMax.[4] Without tfPartialPayment, a payment that cannot deliver Amount within SendMax fails outright; with it, XRPL.org says the ledger will “reduce the received amount instead of failing outright.”[4]
Where does on-ledger pathfinding stop?
On-ledger pathfinding only uses the XRP Ledger’s own order books, AMM pools and trust lines.[1] How Ripple routes payments within its own products is covered on how Ripple routes payments. The case that direct stablecoin pairs will win most routes on their own is set out on whether stablecoins could bypass XRP. A comparison with Stellar is on Stellar versus XRP.
What we know
- XRPL.org defines a path as steps that either pass through another account holding the same currency or trade through an order book or AMM (checked September 29, 2026).
- The XRP Ledger server code (XRPLF/rippled, Payment.h), checked September 29, 2026, sets the limits for a Payment at 6 paths and 8 steps per path.
- One Payment can use several paths at once, and a cross-currency payment either executes in full or not at all, XRPL.org says (checked September 29, 2026).
- The server is not designed to find the absolute best path, XRPL.org says, and the cost along a path can change between submission and execution (checked September 29, 2026).
- A modified, untrusted server could return worse paths to earn money for its operators, XRPL.org warns (checked September 29, 2026).
- 24/7 Wall St. reported on June 29, 2026 a proposal by David Schwartz to reserve trade slots against front-running; it was not yet a formal amendment.
What we reason Analysis
- Pathfinding is a suggestion service and the ledger is the enforcer: the server proposes paths, and the payment executes only within the limits the sender signs. This follows from XRPL.org’s Paths, path_find and Payment pages.
- The main protection against a bad fill is the sender’s own limit (SendMax and the limit-quality flag), not the search. This follows from XRPL.org’s Payment flag descriptions.
What's still open
- How often pathfinding returns a route through XRP for real payments is not known: neither XRPL.org documentation nor news coverage gave a measure as of September 29, 2026.
- The 2023 front-running study cited by 24/7 Wall St. could not be checked directly, and the 24/7 Wall St. report itself could not be retrieved on September 29, 2026. The $1.4 million estimate and the reserved-slot proposal therefore rest on an unverified news report.
In plain English
When someone sends one currency and the receiver wants another, the XRP Ledger needs a route between them. A server searches the ledger’s marketplaces and suggests routes, which can pass through XRP or go direct. The sender picks a route and sets the most they are willing to spend; the payment either goes through within that limit or does not happen. The search can miss the cheapest route, so the spending limit is what protects the sender.
Key terms
Sources
- Paths — XRPL.org, undated (checked September 29, 2026) Primary
- Payment.h (XRPLF/rippled source code) — XRPL Foundation GitHub, develop branch (checked September 29, 2026) Primary
- path_find — XRPL.org, undated (checked September 29, 2026) Primary
- Payment — XRPL.org, undated (checked September 29, 2026) Primary
- Cross-Currency Payments — XRPL.org, undated (checked September 29, 2026) Primary
- Auto-Bridging — XRPL.org, undated (checked September 29, 2026) Primary
- Decentralized Exchange (DEX) — XRPL.org, undated (checked September 29, 2026) Primary
- Behind the Scenes of the XRPL DEX — RippleX Developers (David Schwartz), June 23, 2022 (edited November 15, 2023) Company-reported
- David Schwartz Proposes Reserved Slots to Prevent XRP Ledger Trades From Being Front-Run by Bots — 24/7 Wall St., June 29, 2026 Secondary
Update log
- — Published.
I keep this site free, with no ads, paywall or affiliate links; gifts cover hosting and research time. Support the project, or report an error.
