XRP Wiki
REF · 03.07 / Technology & Protocol

The Built-in Decentralized Exchange (DEX)

How the XRP Ledger's native order-book exchange works, directly at the protocol level.

The XRP Ledger has included a decentralized exchange (DEX) since its earliest design — not as an application built on top of the ledger, but as a native protocol feature. Any account can place an offer to trade one asset for another (XRP or any issued currency) directly, with no smart contract, intermediary application, or separate token required.

How offers work

Placing an offer on the XRPL DEX is a single transaction type (OfferCreate) specifying what you're offering and what you want in return — for example, "500 XRP for 200 USD.issuer-address." The ledger maintains an order book matching compatible offers, and offers can be fully or partially filled, immediately or over time, as matching offers arrive.

Because this lives at the protocol level, offers settle with the same speed and finality as any other XRPL transaction — typically within one ledger close.

Auto-bridging through XRP

One of the DEX's more distinctive features is auto-bridging: if you want to trade currency A issued by one party for currency B issued by a different party, and there's no direct order book between them, the DEX can automatically route the trade through XRP as an intermediate step — even if you never explicitly asked for XRP to be involved — as long as doing so gets you a better or equal price to a direct A-to-B match. This is a direct descendant of XRP's original design purpose as a bridge asset for payments.

Relationship to Ripple's payment products

This same DEX and bridging mechanism is what underlies Ripple's On-Demand Liquidity product: rather than a payment provider needing to pre-fund accounts in every destination currency, a cross-border payment can be sourced in one currency, converted through XRP via the DEX, and delivered in the destination currency, all within the same fast settlement window.

DEX vs. AMM

The order-book DEX has existed since the ledger's beginning; a complementary Automated Market Maker (AMM) was added much later, in 2024. They coexist and can even interact — the AMM can supply liquidity that order-book trades and auto-bridging paths draw on. See Automated Market Maker for how that newer mechanism works and how it differs from the order-book model described here.

No custody, no counterparty risk to an exchange operator

Because trades settle directly between the two trading accounts' own ledger balances, using the DEX does not require depositing funds with a centralized exchange operator — the usual counterparty and custody risks of using a centralized exchange do not apply to the DEX itself (though issuer risk on any non-XRP asset, as described in Trust Lines and Issued Currencies, still does).