{"templateId":"markdown","versions":[{"version":"v1.40","label":"v1.40 STS","link":"/products/custody/v1.40/resources/tutorials/xrpl-ft-trade","default":true,"active":false,"folderId":"c15a2701"},{"version":"v1.39","label":"v1.39 STS","link":"/products/custody/v1.39/resources/tutorials/xrpl-ft-trade","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.38","label":"v1.38 STS","link":"/products/custody/v1.38/resources/tutorials/xrpl-ft-trade","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.34","label":"v1.34 LTS","link":"/products/custody/v1.34/resources/tutorials/xrpl-ft-trade","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.26","label":"v1.26 LTS","link":"/products/custody/v1.26/resources/tutorials/xrpl-ft-trade","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.19","label":"v1.19 LTS","link":"/products/custody/v1.19/resources/tutorials/xrpl-ft-trade","default":false,"active":false,"folderId":"c15a2701"},{"version":"v1.15","label":"v1.15 LTS","link":"/products/custody/v1.15/resources/tutorials/xrpl-ft-trade","default":false,"active":true,"folderId":"c15a2701"}],"sharedDataIds":{"sidebar":"sidebar-products/custody/@v1.15/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Trade fungible tokens in the XRPL Decentralized Exchange","description":"User guides, API reference, and support resources.","siteUrl":"https://docs.ripple.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"trade-fungible-tokens-in-the-xrpl-decentralized-exchange","__idx":0},"children":["Trade fungible tokens in the XRPL Decentralized Exchange"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this tutorial you'll learn how to trade XRP fungible tokens in the Decentralized Exchange (DEX) with ","Ripple Custody","."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"learning-objectives","__idx":1},"children":["Learning objectives"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By the end of this tutorial, you should be able to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create an offer for fungible tokens on the DEX."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Match an offer on the DEX to complete a trade."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-ripple-custody-trades-tokens-on-the-dex","__idx":2},"children":["How Ripple Custody trades tokens on the DEX"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Ripple Custody"," trades on the DEX by creating an ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["immediate-or-cancel"]}," or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["fill-or-kill"]}," offer, both of which must immediately match an offer that already exists on the DEX."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A seller account creates an offer of 1 XRP for 10 tokens."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A token holder account creates an offer of 11 tokens for 1 XRP."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The image below shows this trade:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-flow.80e93fb53630fc940ca776e6d442a8079c66b119215cebaf0342b97b7120e510.53c01680.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"trade-tokens--flow","__idx":3},"children":["Trade tokens — flow"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The workflow to trade fungible tokens on the DEX is as follows:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create a seller offer"]}," — Create an offer from a seller account on the DEX."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create a matching buyer offer"]}," — Create an offer from another account that matches the seller offer."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["View the transaction details"]}," — Check the details of the transaction and associated transfer."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"trade-tokens--instructions","__idx":4},"children":["Trade tokens — instructions"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"prerequisites","__idx":5},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before you begin, we recommend you read the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/resources/tutorials/xrpl-ft-issue"},"children":["Issue fungible tokens on the XRP Ledger"]}," tutorial."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For this tutorial, you will need:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A fungible token to trade. In this tutorial we'll use a token asset called ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["KBO"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An external ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Seller"]}," account, with a balance of XRP native currency."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A ","Ripple Custody"," token ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Holder"]}," account, with a balance of XRP native currency and some ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["KBO"]}," tokens issued from an issuer account."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information on how to create and hold tokens in an account, see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/resources/tutorials/xrpl-ft-issue"},"children":["Issue fungible tokens on the XRP Ledger"]}," tutorial."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A trust line between the holder account and the account that issued the tokens. This can be the same as the seller account, but it can also be a different account. For more information, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/resources/tutorials/xrpl-ft-issue#link-the-issuer-and-holder-accounts-with-a-trust-line"},"children":["Link the issuer and holder accounts with a trust line"]},"."]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Tip"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information on how to:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Create and fund ","Ripple Custody"," accounts, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#create-and-fund-accounts"},"children":["Create and fund accounts"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Fund external accounts, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#fund-external-accounts"},"children":["Fund external accounts"]},"."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-seller-offer","__idx":6},"children":["Create a seller offer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create an offer on the DEX of 1 XRP for 10 KBO from a seller account. Since this is an external account, you need to create the offer using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OfferCreate"]}," from the seller environment."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://xrpl.org/docs/references/protocol/transactions/types/offercreate","target":"_blank"},"children":["Trade in the Decentralized Exchange"]}," in the XRPL documentation."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The offer is now available on the XRP Ledger:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-offercreate.d764647afad0386b63a03b9411be2824b272845572d59509c77f63e938f04122.53c01680.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-matching-buyer-offer","__idx":7},"children":["Create a matching buyer offer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a matching offer in ","Ripple Custody"," from ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Holder"]}," using a transaction order. The offer is 11 KBO for 1 XRP."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To create an offer:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With the UI, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting/tokens/xrpl#create-an-offer-to-trade-on-the-dex"},"children":["Ripple Custody UI > Create an offer to trade on the DEX"]},".",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The transaction order details are as follows:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-offercreate2.5782f500f1a44b9d355d93c5c014cc4bb9bbc6a2b646a26d150ef13a13f23cff.53c01680.png","alt":""},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With the API, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting/tokens/xrpl#create-an-offer-to-trade-on-the-dex"},"children":["Ripple Custody API > Create an offer to trade on the DEX"]},".",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"The payload details are as follows:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"Payload example","header":{"title":"Payload example","controls":{"copy":{}}},"source":"{\n  \"payload\": {\n    \"id\": \"58129d8f-3ff4-4696-8cab-0d649634fbde\",\n    \"ledgerId\": \"xrpl-testnet-august-2024\",\n    \"accountId\": \"29ef6ffe-e24e-474f-ad00-17cd2e016b6b\",\n    \"parameters\": {\n      \"operation\": {\n        \"type\": \"OfferCreate\",\n        \"flags\": [\n          \"tfImmediateOrCancel\"\n        ],\n        \"takerGets\": {\n          \"amount\": \"11000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n          \"currency\": {\n            \"type\": \"TickerId\",\n            \"tickerId\": \"13aac11d-7cfe-481a-8082-8e663eee60bd\"\n          }\n        },\n        \"takerPays\": {\n          \"amount\": \"1000000\"\n        }\n      },\n      \"memos\": [],\n      \"feeStrategy\": {\n        \"priority\": \"Low\",\n        \"type\": \"Priority\"\n      },\n      \"type\": \"XRPL\"\n    },\n    \"description\": null,\n    \"customProperties\": {},\n    \"type\": \"v0_CreateTransactionOrder\"\n  }\n}\n","lang":"json"},"children":[]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"success"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Since the offer of 11 KBO is higher than the amount sought by the seller, the offer matches successfully and the trade goes ahead."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"view-the-transaction-details","__idx":8},"children":["View the transaction details"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To see details of the confirmed transaction and associated objects in ","Ripple Custody",":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["With the UI, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting/transactions/view"},"children":["Ripple Custody UI > View transactions"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["With the API, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting/transactions/view"},"children":["Ripple Custody API > View transactions"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The transaction details are as follows:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-sell-transaction.9f07d854e384456057a162247a789596ecbe60518eaf4779023fd3d105e6e21c.53c01680.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With the transfer of 1 XRP:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-sell-transfer.5b614442d88b3ed9425959374f1d8f5c6358a086024463d467b3871d273a2343.53c01680.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ledger shows the transaction executed successfully:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/xrpl-ft-sell-ledger.fe398e5161a6a6023568c5ff02d559e4c056f7c61af9697d3c5cf4cbff983776.53c01680.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"further-reading","__idx":9},"children":["Further reading"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"xrpl-documentation","__idx":10},"children":["XRPL documentation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://xrpl.org/docs/tutorials/how-tos/use-tokens/trade-in-the-decentralized-exchange","target":"_blank"},"children":["Trade in the Decentralized Exchange"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ripple-custody-documentation","__idx":11},"children":["Ripple Custody documentation"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"issue-xrpl-fungible-tokens","__idx":12},"children":["Issue XRPL fungible tokens"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/resources/tutorials/xrpl-ft-issue"},"children":["Tutorials > Issue fungible tokens on the XRP Ledger"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-and-fund-accounts","__idx":13},"children":["Create and fund accounts"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting-entities/account/create"},"children":["Ripple Custody UI > Create accounts"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting-entities/account/create"},"children":["Ripple Custody API > Create accounts"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting/receive-assets"},"children":["Ripple Custody UI > Receive assets"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting/receive-assets"},"children":["Ripple Custody API > Receive assets"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"fund-external-accounts","__idx":14},"children":["Fund external accounts"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting/send-assets"},"children":["Ripple Custody UI > Send assets"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting/send-assets"},"children":["Ripple Custody API > Send assets"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"view-account-balances","__idx":15},"children":["View account balances"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/ui/accounting-entities/account/view#check-account-balances"},"children":["Ripple Custody UI > Check account balances"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/custody/v1.15/api/accounting-entities/account/balances#check-account-balances"},"children":["Ripple Custody API > Check account balances"]}]}]}]},"headings":[{"value":"Trade fungible tokens in the XRPL Decentralized Exchange","id":"trade-fungible-tokens-in-the-xrpl-decentralized-exchange","depth":1},{"value":"Learning objectives","id":"learning-objectives","depth":2},{"value":"How Ripple Custody trades tokens on the DEX","id":"how-ripple-custody-trades-tokens-on-the-dex","depth":2},{"value":"Trade tokens — flow","id":"trade-tokens--flow","depth":2},{"value":"Trade tokens — instructions","id":"trade-tokens--instructions","depth":2},{"value":"Prerequisites","id":"prerequisites","depth":3},{"value":"Create a seller offer","id":"create-a-seller-offer","depth":3},{"value":"Create a matching buyer offer","id":"create-a-matching-buyer-offer","depth":3},{"value":"View the transaction details","id":"view-the-transaction-details","depth":3},{"value":"Further reading","id":"further-reading","depth":2},{"value":"XRPL documentation","id":"xrpl-documentation","depth":3},{"value":"Ripple Custody documentation","id":"ripple-custody-documentation","depth":3},{"value":"Issue XRPL fungible tokens","id":"issue-xrpl-fungible-tokens","depth":4},{"value":"Create and fund accounts","id":"create-and-fund-accounts","depth":4},{"value":"Fund external accounts","id":"fund-external-accounts","depth":4},{"value":"View account balances","id":"view-account-balances","depth":4}],"frontmatter":{"seo":{"title":"Trade fungible tokens in the XRPL Decentralized Exchange"}},"lastModified":"2025-10-28T02:35:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/custody/v1.15/resources/tutorials/xrpl-ft-trade","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}