Using the Built-in DEX
Trade tokens directly on the XRP Ledger decentralized exchange: understand order books, swap tokens, and how the DEX differs from centralized exchanges.
What you'll learn
- Explain in plain language what a decentralized exchange (DEX) is and how it differs from a centralized one.
- Describe what happens when you swap one token for another on the XRP Ledger.
- Tell apart the two ways the DEX finds you a price: order books and automated market makers (AMMs).
- Recognize slippage and why a swap can settle at a slightly different price than expected.
Overview
You already know how to send and receive XRP. This module answers the natural next question: what if you want to trade one kind of digital money for another? Maybe you hold XRP and want a token instead, or the other way around.
The XRP Ledger has a marketplace built right into it — a decentralized exchange, or DEX — where you can swap one asset for another without handing your money to a company first. By the end you'll understand what a DEX is in everyday terms, what actually happens when you "swap," the two ways the ledger finds you a price, and a word you'll bump into a lot: slippage. No coding, no jargon — just the mental model a newcomer needs before placing a first trade.
What is a decentralized exchange?
Picture a currency exchange counter at an airport. You hand over one currency, you get another back, and the counter — a company — sits in the middle, holds the money, and sets the rules. A centralized exchange (like the big crypto apps you may have heard of) works the same way: you deposit your funds into the company, trade inside their system, and trust them to give it back when you ask.
A decentralized exchange (DEX) removes the company from the middle. Instead of depositing your money into someone's vault, trades happen directly on the XRP Ledger — the same shared, public record you already learned about. Your assets stay in your wallet until the moment a trade settles, and the swap is just another transaction the network confirms.
Two everyday consequences follow from that:
- You stay in control of your money. There's no company holding it, so there's nothing to "withdraw" and no account that can be frozen. The flip side: there's no help desk either, so you're responsible for your own wallet (which is exactly why the recovery phrase you protected earlier matters).
- It's built in, not bolted on. The DEX isn't a separate website that happens to use XRP. It's part of the ledger itself — one of the original reasons the XRP Ledger was created back in 2012.
What happens when you swap?
A swap is simply trading one asset for another — say, some XRP for a token, or a token back into XRP. From your seat it feels as easy as exchanging cash: you pick what you have, pick what you want, and confirm.
In a wallet like Xaman, the steps look like this:
- You choose the asset you're giving and the asset you want.
- You enter an amount.
- The wallet shows you the price you'd get and asks you to sign — to approve — the trade.
- You sign, the network confirms it in a few seconds, and the new asset lands in your wallet.
Behind that simple screen, the ledger is doing the matchmaking — finding someone (or something) willing to give you what you want at a fair price. You never have to see that machinery, but it helps to know there are two ways it can happen. That's the next section.
One important note before you trade real value: to hold most tokens other than XRP, your wallet first has to "agree" to accept that token — a one-time step called a trust line. Xaman usually offers to set this up for you as part of the swap, so you rarely think about it, but that's why a brand-new token sometimes asks for an extra confirmation.
Order books vs. AMMs, at a glance
The XRP Ledger can find you a price in two different ways, and a good wallet quietly uses whichever gives you the better deal. You don't have to choose — but knowing both demystifies a lot.
Order books — like a noticeboard of offers. Imagine a community noticeboard where people pin index cards: "I'll sell 100 tokens for this price" or "I'll buy 50 at that price." An order book is exactly that, kept on the ledger. When you swap, the network matches your request against the best cards on the board. If someone's offer fits, you trade with that person directly.
AMMs — like a self-service vending machine. An automated market maker (AMM) has no person on the other side. Instead there's a shared pool of two assets — think of a tank holding both XRP and a token — and a simple formula sets the price automatically based on how much of each is in the pool. You trade with the pool, not with a human. It's always open, always available, and the price adjusts as people trade. The pool is filled by other users (called liquidity providers) who deposit their assets and earn a small share of the trading fees in return.
The everyday takeaway: order books match you with people; AMMs trade you against an automatic pool. Both live on the XRP Ledger, and the network can even combine them to get you the best result — so as a beginner, you mostly just confirm a swap and let the ledger sort out the rest.
Slippage, in plain language
Here's a word that sounds technical but describes something very ordinary. Slippage is the gap between the price you expected and the price you actually got.
Why does it happen? Prices move. Between the moment your wallet shows you a quote and the moment the network confirms your swap a few seconds later, other people may be trading too, nudging the price. And the bigger your trade relative to how much is available, the more your own swap moves the price — like buying every sandwich in a small shop: the last one costs more than the first.
A homely analogy: you see a sign reading "apples, $1 each," but by the time you reach the front of the line they're $1.05. That nickel is slippage.
The good news is you're usually protected. Wallets let you set a slippage limit — a "don't let the price drift more than this much, or cancel the trade" guardrail. A few habits keep things calm:
- Start small. Trade a tiny amount first to see how it behaves.
- Watch the quote. If the price you're offered looks far off, pause.
- Mind thin markets. Brand-new or obscure tokens often have little available to trade, so slippage can be large. Popular pairs move less.
Slippage isn't a scam or a hidden fee — it's just prices being alive. Knowing the word means it won't surprise you.
Check
You're done when you can comfortably explain — out loud or in a few written sentences — what a DEX is (a marketplace built into the XRP Ledger where you trade directly from your own wallet, with no company holding your money), what happens when you swap (you pick what you have and what you want, sign, and the network settles it in seconds), the two ways a price is found (an order book matches you with people; an AMM trades you against an automatic pool), and what slippage means (the small gap between the price you expected and the price you got).
For your artifact, do a swap on the testnet — practice money, no real funds at risk — using a wallet like Xaman, then write a few sentences describing what you did and how it felt compared to a centralized exchange.
Assignments
0 of 1 complete