This AMA (Ask Me Anything) features Aanchal from Ripple! ICYMI, we discussed the work she and her team are doing alongside David Schwartz around XLS30d - the native Automated Market Maker (AMM) on XRPL.
Check out the full recap below, and head to xrpldevs.com to join the community and tune in for the next AMA!
BiasGoose: Hello everyone! Welcome to another XRPL Developers Discord AMA! Today I’m here with @aanxhal from Ripple to chat about XLS-30d: Automated Market Maker on XRPL 🫂
Welcome @aanxhal 👋
@aanxhal please introduce yourself to the community and let us you know what you do at Ripple 🙂
Aanchal: Sure! Hi everyone! Thanks for joining. It's an absolute pleasure to be here.
I am Aanchal Malhotra. I joined Ripple in 2019 after finishing my PhD in Computer Science from Boston University. I lead the Protocol design and cryptography research team at RippleX. My team focuses on designing new primitives and protocols for XRPL to enable efficient application development. I co-authored XLS 20d - The Non-fungible Token standard on XRPL - which is now LIVE on mainnet (YAY!). More recently, I co-authored XLS 30d - Native Automated Market Maker on XRPL with Ripple CTO David Schwartz.
Another initiative driven by the team is to come up with innovative solutions to enhance XRPL scalability and enable pro-compliance privacy applications. This includes exploring advanced cryptographic primitives such as Threshold signatures, Zero-Knowledge proof systems, roll-ups and decentralized identity, etc. This is a relatively new direction, so more to come on this soon!
BiasGoose: Awesome! Excited to have you here to chat about the AMM spec!
Let's start with some fundamentals. Can you give us a high-level explanation of what the AMM is and what it will bring to the XRP Ledger?
Aanchal: Sure. Let me take a step back and explain the current state-of-art for DEX on XRPL.
XRPL has had a Central limit order book (CLOB) based DEX since 2012. In many ways, a CLOB based DEX is similar to traditional exchanges. They maintain an aggregated list of bid and ask offers and trades are executed by matching the incoming offers with those in the order book. Market makers in CLOBs profit from bid-ask spread.
Order book based exchanges are optimal for highly liquid markets because the spread is small and the depth of demand and supply is high.
However, they are not great for illiquid markets, where users might have to wait for long periods to get their orders fulfilled if one does not exist in the order book that matches their order.
And more importantly, CLOB based DEXs are not scalable on public blockchains because of expensive transaction cost and limited storage capabilities.
These are some of the reasons that gave rise to Automated Market Maker (AMM) based DEXs. An AMM is a type of DEX protocol that pools liquidity from users. For example, in the case of trade execution, the protocol uses a mathematical formula that takes into account the current liquidity of a trading pair and provides an instant quote. In other words, instead of referring to an order book to get a price, you’ll get it as a result of a pre-defined algorithm.
AMM market makers make profits from a trading fee that is charged to the traders for trading against the AMM instance. Compared to CLOBs, they provide quotes even for illiquid assets and a simpler user-experience. In short, AMMs target a different segment of traders, LPs and use-cases with its unique trade execution and incentives model.
BiasGoose: This answer is already baked in but why is there a need for an AMM on the XRP Ledger? And what are some of the key differentiating factors in this spec?
Aanchal: XRPL has some inherent capabilities—fast finality, lower transaction costs and fair transaction ordering—that makes it well suited to support an AMM based DEX.
Elaborating more, key differentiators include:
Protocol native: Allows developers to utilize AMM functionality without having to create their own smart contracts and face associated risks, so it's more secure.
No front-running or MEV: Inherited benefit from the XRPL’s federated consensus – there are no miners to prioritize only higher gas fee orders.
DEX Integration: The proposal allows for the integration of CLOB and AMM on XRP Ledger. This enables price optimization to determine whether swapping within a liquidity pool or through the order book provides the best price and executes accordingly.
Single-sided Liquidity Provision: Anyone can easily participate as a Liquidity Provider. 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 and improves UX.
Continuous Auction Mechanism: This is an absolute novel feature. The team proposes a unique mechanism where the AMM instance continuously auctions off trading advantages to arbitrageurs, charging them and giving these earnings to its liquidity providers. This allows liquidity providers to take a large share of the profits that would normally be taken by arbitrageurs.
BiasGoose: From the user experience perspective #4 is really great since buying various tokens to turn into an LP token adds several steps for the user and is more confusing. Can you tell us more about who the ecosystem participants in the AMM would be?
Aanchal: Sure, there are:
Liquidity Providers who add liquidity to the AMM pools.
Traders who swap one asset for another for a fixed fee. e.g. speculators, arbitrageurs, App users, etc.
Developers who can integrate directly with AMM DEX pools to power exciting interactions with tokens, trading interfaces, retail experiences, etc. (e.g. Wallets, DEX aggregators).
Each participant plays a significant role to build a thriving AMM ecosystem. While designing the protocol the goal is to make sure to take into account the motivation for each participant and to optimize it for all.
BiasGoose: Thank you! Can you also tell us a bit more about the continuous auction mechanism? Seems like an important differentiator.
Aanchal: Yes, aka the "secret sauce" 🙂
Let me start by defining the problem/friction point to try and solve through Continuous Auction Mechanism (CAM). Impermanent Loss is an inherent problem with AMMs. It happens when volatility or asymmetric trading cause the relative price of assets in AMM pools to go out-of-sync with that of external markets. And an AMM does not adjust the prices automatically due to lack of external market information. As a result, arbitrageurs intervene. But, they have to:
- Wait until the profit from the transaction (and thus the pool’s expected loss) exceeds the trading fees
- Race/Compete against others who are also trying to arbitrage (reduces success probability!)
This results in decreased trading volumes and hence a loss to pool and the liquidity providers because of low trading activity.
And second, when arbitrageurs trade to balance the two markets, they make profits at the expense of the pool. With CAM, a mechanism exists for both the arbitrageurs and LPs, i.e.
- AMM continuously sells-off trading advantages for 24-hour periods at near zero trading fee!
- Proceeds from the auction are divided between: - Previous slot-holder (computed pro-rata) - AMM pool
As a result, this eliminates wait time & race condition for auction slot holder (arbitrageur), thus reducing the periods of reduced trading activity; reduces the impact of Impermanent Loss for liquidity providers (LPs); and liquidity providers reap a share of profits that would otherwise go JUST to arbitrageurs.
BiasGoose: Thank you for walking us through that. One quick question to answer someone from the community - will NFTs be tradable in the AMM (à la Sudoswap)?
Aanchal: The current proposal does not support Non-fungible tokens. One can create XRP-IOU as well as IOU-IOU pools. XLS-30d proposes a weighted geometric mean market maker (GM3) where the spot-price is computed as the ratio of two assets in the pool.
BiasGoose: Another one from the community - Is there any overhaul planned for block explorer with regards to AMM? e.g. easier-to-read representation of swaps and liquidity transactions
and is there any analytics planned for the AMM?
Aanchal: Thanks for asking!
The plan isn’t to overhaul the explorer, livenet.xrpl.org, but to add direct support for AMM. This includes new object types, transactions, and a specific page for the AMM account which will include the current status of the AMM, token types, balances, and all transactions that have occurred since inception.
It’s suspected that other explorers in the XRPL community, such as XRPScan and Bithomp, will add AMM support as well.
For Analytics: There are no plans to build public-facing AMM analytics tooling at the moment. However, there are a number of interesting projects in the blockchain space that offer data visualization and token info that have expressed interest in supporting XRPL tokens & DEXs. The XRPL also has public APIs available, such as OnTheDex.live, Public HTTP/Websocket, Sologenic XRPL Trading Data, etc. that are available to pull ledger & DEX data.
BiasGoose: Last question - Is there a way for AMM to blacklist addresses? (e.g. from OFAC Sanctions List)
Aanchal: There is no special provision for AMM instances in this proposal to blacklist addresses. However, IOU issuers can restrict the accounts that can hold/transfer IOUs by setting the ReqAuth flag. This could, to some extent, control who can interact with that specific AMM instance. This feature already exists!
For more info on Authorized trustlines - here is the link https://xrpl.org/authorized-trust-lines.html.
BiasGoose: Amazing! Well @aanxhal this was a great conversation and I can say for myself, I learned a lot! 🙂
Can you tell us where the proposal is in the timeline and where the community can go to test it out and learn more?
Aanchal: Of course. Thanks all for joining and asking thoughtful questions. I would strongly encourage everyone to read the technical spec on Github and offer feedback on the AMM release on Devnet.
Also, do not hesitate to reach out if you have any other questions/suggestions. The hope is to propose an amendment Q1 this year.
Check out more details on the XLS-30d standard on GitHub: https://github.com/XRPLF/XRPL-Standards/discussions/78
To catch upcoming AMAs, join the XRP Ledger developers discord.
Top comments (0)