xrplswap #2 — XRPL’s DEX

Joonha Lee
xrplswap
Published in
5 min readSep 18, 2023

※ xrplswap is the first AMM DEX on XRP Ledger. The xrplswap series #1–4 are official community documents from the xrplswap team to introduce xrplswap to XRP holders.

[xrplswap series]
1. XRPL, XRP’s Blockchain
XRPL’s DEX
3. Advanced Decentralized Token Exchange Mechanism, AMM
4. Introducing xrplswap, XRPL’s first AMM DEX

xrplswap ⓒ 2023. xrplswap

XRPL’s DEX

[Table of Contents]
1. Key Transactions on XRPL, Token Exchanges
2. Trading on XRPL
3. What is DEX?
4. XRPL’s DEX
5. Limitations of XRPL DEX: Order Book-Based

In the previous post, we explored what XRP Ledger (hereinafter XRPL) is and its direction. In this post, we will delve into token exchanges within XRPL transactions and XRPL’s native DEX designed for this purpose.

Key Transactions on XRPL, Token Exchanges

XRP has facilitated fast and convenient exchange and remittance between various fiat and cryptocurrencies. XRPL serves as the main network that uses XRP as its native asset. Therefore, XRPL supports smooth exchange between various tokens in alignment with the philosophy of XRP.

Trading on XRPL

We are already familiar with exchanging tokens. If you want to buy ETH with BTC, you can sell BTC for ETH on centralized exchanges like Binance or Coinbase, which are also known as Centralized Exchanges. The same applies to XRPL. If you want to purchase ETH with BTC on XRPL, you can exchange BTC tokens for ETH tokens on XRPL’s centralized exchange. The sequence involves exchanging BTC tokens for XRP and then exchanging XRP for ETH tokens.

However, centralized exchanges have inherent limitations. A centralized exchange holds your assets in custody, converts them to assets on the exchange, and then executes trades. Since only transactions authorized by the exchange can be executed, your assets are effectively under the complete control of the centralized exchange. Therefore, exchanges require your unconditional trust. However, this is not secure because no one, including the exchange, is an authorized entity on the blockchain. It is also risky because large amounts of money are pooled in a single location, the exchange, which can be a target for hacking and other security crimes.

list of cryptocurrency exchange hacks

To address this issue, XRPL has introduced an order book-based DEX.

What is DEX?

A DEX (Decentralized Exchange) is an exchange where the role of intermediating trades, typically performed by centralized exchanges, is replaced by blockchain technology. There can be various methods to implement a DEX, but the approach currently supported by XRPL is the order book-based method. In an order book-based DEX, buy and sell orders are matched similarly to centralized exchanges, pairing buy orders with sell orders. In blockchains with smart contracts like Ethereum, smart contracts automatically execute these trades. In XRPL, which doesn’t rely on smart contracts, a specific type of transaction is responsible for executing the trades on the DEX automatically. Users no longer need to entrust their assets to and place trust in a specific untrusted entity like a centralized exchange.

XRPL’s DEX

XRPL’s DEX is supported at the XRPL protocol level itself, rather than relying on smart contracts, which provide a higher level of security. Most other blockchain-based DEXs rely on smart contracts, and in such cases, the security of the DEX can be vulnerable to flaws or errors in the smart contract code.

XRPL’s DEX, which operates at the protocol level, also has the advantage of integrated liquidity. XRPL’s DEX is a mere “feature” without a separate operator. Therefore, unlike in other blockchains where DEXs may have their own separate liquidity, resulting in multiple fragmented trading paths, XRPL has unique trading paths for each token pair. Users can fully benefit from the substantial liquidity available through XRPL’s DEX.

Another noteworthy feature of XRPL’s DEX is automatic bridging. To exchange A tokens for B tokens, you must find a corresponding trade that converts B tokens to A tokens. It can be challenging to find such a corresponding trade unless the token pair is actively traded. XRPL internally supports splitting this trade into two steps: exchanging A tokens for XRP and then XRP for B tokens. This increases the probability of finding a corresponding trade, contributing to enhanced liquidity within XRPL’s DEX.

Limitations of XRPL DEX: Order Book-Based

Despite XRPL’s efforts to increase liquidity, its order book-based DEX still has limitations. Even with the introduction of intermediary coins/tokens to boost liquidity, ultimately, there must be trading pairs in both directions, and they need to be matched. However, this process is not straightforward for the following reasons, as I will explain next.

Firstly, XRPL’s DEX has a limited number of users. The reason for the higher user count on centralized exchanges is often attributed to familiarity and convenience. In contrast, XRPL’s order book-based DEX, aside from the less immediately visible benefits of decentralization and security, does not offer users direct advantages such as convenience.

In DEXs with a low user base, liquidity tends to be insufficient, leading to high slippage. Slippage refers to the phenomenon where trades are executed at prices different from the intended price. High slippage, in turn, hinders user participation and creates a vicious cycle that further reduces liquidity.

Lastly, it’s because of the inherent limitations of “order book-based” DEXs. As mentioned earlier, in order book-based DEXs, trades require corresponding trades in the opposite direction to execute. Regardless of the size of the liquidity, if there are no matching trades, the trading process can come to a halt.

Outro

So far, we’ve looked at XRPL’s primary transactions, token exchanges, and its order book-based DEX for executing these transactions, while also addressing their limitations. The next article will explore potential solutions to these limitations through Automated Market Makers (AMMs) to enhance market liquidity.

Reference

ⓒ 2023. xrplswap ALL RIGHTS RESERVED

--

--