XRPL AMM Network Available for Testing and Development
Tags: xrpl, amm, dex, defi
Published: 2022-11-29 19:53:31

Earlier this year, the RippleX team [proposed](https://dev.to/ripplexdev/a-proposal-for-the-future-of-the-xrp-ledger-dex-4l7e) the XLS-30d technical specification to build a protocol native automated market maker (AMM) integrated with the orderbook-based DEX on the [XRP Ledger](https://www.xrpl.org/). 

This expansion was proposed to bring additional exchange functionality and utility to XRPL token holders, with the goal of enabling enterprise developers to build high performance applications for their users using the right tools and technical documentation.

**Today, the AMM Devnet is live and ready to use, and we invite developers to test the AMM, build innovative applications, and [ask questions or provide feedback on Discord](https://discord.com/channels/886050993802985492/956956779277844501)**. For urgent inquiries, [you can contact the development team](mailto:xls30@ripple.com). Developers can integrate their apps directly with the AMM to power interactions with tokens, trading interfaces, retail experiences and more while taking advantage of liquidity provision, swap and auction features. 

Following extensive testing and community feedback, RippleX plans to propose an amendment to adopt XLS-30d to XRPL mainnet. The decentralized XRPL validator community will then carefully review the proposal and evaluate its technical merits. If greater than 80% of the validators accept the proposal—and approval remains at or above 80% for a minimum of two weeks—a functioning AMM protocol as specified in XLS-30d will become live, open source technology on the XRP Ledger. 


**Understanding XLS-30d**

XLS-30d introduces a protocol native AMM to the XRPL. It will exist as a core primitive of the Ledger and employ a set of fixed functions that allow application developers to create interfaces for end traders and liquidity providers (LPs). It also introduces a novel auction mechanism that incentivizes arbitrageurs while reducing the impact of impermanent loss faced by LPs. 

Further, the AMM is less vulnerable to Miner Extractable Value (MEV) or front-running because the XRPL leverages Federated Consensus and canonical transaction ordering. The AMM also allows for single-sided liquidity provisioning which simplifies the user experience:

**XLS-30d Core Features**

- **Protocol native build:**

    - As a core primitive of the XRPL, developers can utilize AMM functionality without the need to create their own smart contracts and face associated risks.  
- **Continuous Auction Mechanism:**

    - The implementation of a continuous auction mechanism requires arbitrageurs to bid to capture price discrepancies.
    - The AMM continuously auctions trading advantages for 24-hour periods at near zero trading fees, such that arbitrageurs do not have to wait for profits to exceed fees. This results in immediate arb trading and maintains stable volatility.
    - Proceeds from each auction are partially refunded to the prior arbitrage slot holder and partially burnt, effectively reducing impermanent loss.

- **Single-sided Liquidity Provision:** 
    - Only a single asset is required to contribute to a pool. The protocol swaps on an LP’s behalf to maintain a 1:1 ratio, thus decreasing the number of steps for users. 

- **No Miner Extractable Value (MEV) or front-running:**
    - The XRPL uses federated consensus, meaning that each ledger (equivalent to a “block”) is determined by a consensus of participants whereby no single party can dictate which transactions or ledgers are valid. There are no miners to prioritize only certain transactions (namely higher gas fee orders) to the Ledger.   
    - The proposed AMM’s (and existing DEX) orders inherit the core ledger’s canonical transaction ordering determined by the distributed network of validators, thus making it near impossible to front-run transactions. 

- **CLOB DEX Integration:**
    - The AMM is integrated with the central limit order book (CLOB)-based DEX and enables price optimization to determine whether swapping within a liquidity pool, through the order book, or both provides the best price and executes accordingly.

**Why Build an AMM?**

An AMM will provide efficient liquidity for a wide range of assets, and allows any participant to engage in market making as a liquidity provider (LP) and earn passive income on their tokenized assets. The XRP Ledger’s inherent advantages—extremely low transaction cost, fast block times, fair transaction ordering—make it very suitable and lucrative for all participants within the AMM ecosystem.



|          | CLOB        | AMM        |
| ---      | ----------- |----------- |
| **Trading Structure** | Trading happens by matching the incoming orders with those in the traditional on-chain order books of buy and sell offers| Trading happens automatically using pools of available tokens and a predetermined algorithm|
| **Liquidity Supply Structure** | Strategic liquidity suppliers actively compete with each other – the costs and benefits of supplying liquidity are individual to each liquidity supplier| Liquidity suppliers pool assets, typically via smart contracts. Benefits and costs are mutualized: Liquidity suppliers are not in competition|
| **Price Impact** | Liquidity suppliers choose the price impact that maximizes their profits | The transaction price is determined by the bonding curve and is perfectly predictable given the size of the liquidity pool|
| **Market Makers** | Experienced or professional market makers provide liquidity in size| Anyone can play market maker and provide liquidity at smaller increments 
| **User Experience** | More complex for end trader | Simple for end trader

**How to Get Started**

The AMM is currently live on a devnet and reference documentation can be viewed [here](https://xrpl.org/label-amm.html). 

AMM Development Network access information:
Websocket: wss://amm.devnet.rippletest.net:51233
JSON-RPC: http://amm.devnet.rippletest.net:51234

All developers are welcome to build integrations and test functionalities on this open source technology. There is an active [Discord](https://discord.com/channels/886050993802985492/956956779277844501) community where developers can share ideas and ask questions to other XRPL community members.