Since the inception of Monero atomic swaps — largely due to Joel Gugger’s adaption of adaptor signature-based swaps for Monero (as we’ve detailed here) — they have only been unidirectional, meaning it’s only been possible to buy or sell Monero as the 'taker' of a swap offer, never as the initiator. This is due to certain technological constraints behind the semi-scriptless adaptor signature scheme that is required for XMR swaps.
Today, we’re extremely proud to announce the implementation of bi-directional Monero and PART (Anon) atomic swaps on BasicSwap DEX, meaning swaps can now be facilitated in both directions.
In this blog post, we will delve deeper into the significance of this achievement, the methodology used to accomplish it, and its impact on the preservation of our privacy and liberties moving forward.
Table of Contents
- Why are Bidirectional Swaps Significant?
- Brief History of Monero Atomic Swaps
- The Big Caveat with PART(Anon) and XMR Atomic Swaps
- Bidirectional PART(Anon) and XMR Swaps Are Here!
- How was it Accomplished?
- Leveraging the SMSG Network
- Simulating Offers Requesting Part (Anon) and XMR
- Technical Documentation
- How to Use
- What Impact Will This Have on Our Future?
- Decentralized Trading Exchanges: The Ultimate Refuge
- The Road Ahead
Why are Bidirectional Swaps Significant?
To fully comprehend the significance of bidirectional adaptor signature atomic swaps, it's essential to first explore the historical development and functionality of conventional, unidirectional semi-scriptless swaps.
Brief History of Monero Atomic Swaps
As we outlined in a recent blog post, atomic swaps have long-been available to the general public ever since the advent of basic HTLC-based atomic swaps, a technology that was first implemented by the Decred team.
HTLC swaps permit the free and trustless exchange of digital assets between two parties. However, they necessitate that both cryptocurrencies involved in the exchange have programmable outputs, among other requirements. This swap type is available for a wide array of coins, but not for Monero.
As the most commonly used 'privacy coin' today, Monero is particularly important for BasicSwap’s goals, and boasts an extensive anonymity pool and high levels of financial privacy. This reinforces its impressive potential as an ideal digital cash form, but the concerted efforts in restraining its use by anti-freedom actors highlight the need for a counterparty-free trading solution.
That’s why Monero contributor, Joel Gugger — also known as H4sh3d — proposed a new Monero-compatible atomic swap protocol based on adaptor signatures. This breakthrough development, a product of the collaborative efforts of open-source developers over years, finally opened the door to the facilitation of atomic swapping of Monero without the need for programmable outputs.
Note: For a more in-depth look into the history of atomic swaps, check out our recent blog post on the topic here.
The Big Caveat to Monero Atomic Swaps
While the advent of Monero atomic swaps using adaptor signatures represented a significant advancement, it came with a notable limitation: they could only operate in one direction. To clarify this, it's crucial to realize that in an atomic swap, the roles of the participants are distinct: there's an 'offerer' and a 'bidder' (or ‘taker’).
The offerer creates a swap request — for BasicSwap, this means listing a swap request, often referred to as an 'offer', on the DEX's order book. The bidder, in contrast, reviews the terms of the swap request (the 'offer') and, upon agreement, initiates the swap process.
The offerer dictates the swap's parameters, including the offered and requested coins, their respective quantities, and the exchange rate. While there are other parameters to set, such as the lock contract expiry time for example, they are not specifically pertinent to this article's context.
Due to the technological foundation of semi-scriptless atomic swaps, the offered coin must possess scriptable outputs, or more accurately, some form of malleability fix, often implemented as Segwit. This stipulation presents an improvement on HTLC swaps, which require programmable outputs for both coins, but in either cases, this prevents Monero from being offered in exchange for other coins, due to its lack of scriptable outputs.
To better understand this unidirectionality, consider this flow chart which describes a typical adaptor signature based atomic swap involving Monero, from the perspective of the 'offerer'.
Note that this does not imply that a Monero holder cannot swap it for Bitcoin — a Bitcoin holder could create an offer to exchange Bitcoin for Monero, which the Monero user could then accept and initiate a swap. However, it does mean a Monero holder cannot be the one to create the offer. In other words, if you hold Monero and want Bitcoin, you must accept an offer created by someone else requesting Monero for Bitcoin. If you hold Bitcoin and want Monero, then you must create an offer offering Bitcoin for Monero.
This restriction considerably impacts the user experience in a negative way and adds complexity to the end user as it prevents them full access to the standard functionalities provided by atomic swaps and, more broadly, by centralized trading exchanges. It also prevents Monero offerers from trading at the exact rate they want, as they are constrained to the rates of existing trade offers.
To mitigate this issue, we have devoted consistent effort to developing a solution, with the goal of providing Monero users with the same advantages enjoyed by users of other coins on a DEX like BasicSwap.
Bidirectional Monero and Part (Anon) Swaps Are Here! 🎉
We are proud to announce that we’ve finally implemented bidirectional Monero atomic swaps into BasicSwap mainnet, now available on the live beta and accessible for everyone! This breakthrough implies that the prior constraints on Monero users are no longer relevant, and that Monero users can now both request AND offer Monero when adding offers on BasicSwap's order book.
How was it Accomplished?
Monero atomic swaps being solely a unidirectional process is a direct consequence of Monero's robust codebase which offers limited scripting capabilities, but enhanced resilience against different types of exploits.
As such, we achieved bidirectional swaps without altering the Monero codebase or making extensive changes to Joel Gugger’s adaptor signature-based Monero atomic swap protocol (beyond our previous enhancements to the protocol's privacy and transaction size management, as detailed here).
Instead, our strategy leveraged BasicSwap's strong suit — its use of the SMSG network with a focus on end user experience. After all, BasicSwap's primary goal as a DEX protocol is to simplify the process of atomic swaps and make it easy and more accessible for people to transition away from centralized exchanges. Therefore, user experience is paramount and is what truly matters in our case.
Leveraging the SMSG Network
On BasicSwap, the offerer creates a swap request or 'offer' on the DEX’s order book, while participants (aka 'bidders') take a look at the order book, locate an offer that interests them, and initiate a swap. This process mirrors the maker-taker system of traditional centralized cryptocurrency exchanges.
However, this user experience isn't inherently part of atomic swap technology, as we've outlined in this blog post, but is facilitated by Particl's unique SecureMessaging Network (SMSG), a decentralized, privacy-first messaging network, also known as 'mixnets' (see this article for more information on SMSG).
The SMSG network serves as a powerful tool and a crucial component in making BasicSwap DEX a user-centric platform. Turns out, it also ultimately became the key to implementing bidirectional Monero atomic swaps.
Simulating Offers Requesting Monero
Our solution to the unidirectionality of Monero atomic swaps doesn't hinge on modifying the Monero codebase or its adaptor signature atomic swap protocol. Instead, it leverages the SMSG network to simulate offers featuring Monero.
In reality, BasicSwap still employs the same semi-scriptless adaptor signature protocol. Hence, at the protocol level, the swaps remain unidirectional. However, by integrating an additional automated step into the swap process — powered by the SMSG network — we've made it appear as if Monero can now be offered.
Even though it is fundamentally a clever workaround — essentially providing the illusion of a truly bidirectional swap — it is entirely seamless for the end user and doesn't necessitate any additional manual input or requirements.
Refer to the original adaptor signature atomic swap flow chart provided earlier in this article. Now, compare it to this flow chart displaying the process of executing a 'reverse Monero atomic swap' using adaptor signatures on BasicSwap DEX, again from the perspective of the offerer.
From this, it's clear that the base protocol stays the same, but there are a few more steps and processing involved — all occurring in the background without necessitating further human intervention.
Indeed, whereas a PART (or BTC) to XMR swap would send a bid, a XMR to PART swap instead sends a 'bid request' that has to be accepted by the bidder. A bid is then constructed from this request and the protocol proceeds as normal, just with the parties transposed.
Some of our more technically-minded friends reading this may be seeking more detailed documentation as to how this was made possible, or may even want to have a look at the code.
Since BasicSwap DEX is entirely open-source, we’ve got you covered on that end! You can consult this raw documentation or these visual graphics (1, 2) to get a better understanding of how it all works, or you can simply look at the code directly by checking out the latest commits on Github here.
How to Use
Using bidirectional XMR swaps on BasicSwap is as straightforward as conducting standard HTLC swaps, as it has been seamlessly integrated into the DEX's user interface. Now, in contrast to the previous setup where Monero could only be chosen as the requested coin, you also have the option to offer it when placing a new offer on the order book.
There are no extra steps or additional prerequisites involved. However, remember that this process is fundamentally a unidirectional atomic swap, enhanced with some additional SMSG logic. Therefore, the other cryptocurrency you're requesting should have some form of malleability fix in place, like Segwit, just like any other adaptor signature-based atomic swap.
To benefit from the new bidirectional atomic swaps, all you need to do is ensure that your local BasicSwap instance is up-to-date with the latest version. To install it, simply update BasicSwap through the usual process (video walkthrough) and launch the DEX again.
- Shutdown BasicSwap properly and stop the Docker image.
- From the
basicswapfolder, type the
- In the
/dockerfolder, run the
- Once the process completes, launch BasicSwap again using the
If you're not using the Docker setup, you can follow the Particl Academy's step-by-step update guide here.
What Impact Will This Have on Our Future?
The introduction of bidirectional Monero atomic swaps for all symbolizes a monumental step towards establishing a privacy-first, resilient global economy that is fair to all.
Indeed, we've observed a steady increase in aggressive, restrictive measures targeting privacy coins like Particl and Monero in recent years, a trend that has only accelerated in recent weeks. As evidenced by the removal of the cryptocurrency from numerous centralized exchanges such as Binance, the accessibility of Monero has significantly dwindled for many individuals worldwide. The rate at which these measures are being enforced is only likely to speed up over time.
Furthermore, draconian, anti-freedom regulations are being enshrined in law or, at the very least, being seriously considered by several governments across the world. Some of the most severe instances involve countries considering a total ban on end-to-end encryption in apps and messaging, a crucial functionality in safeguarding our individual liberties and privacy. As these circumstances evolve, it becomes increasingly clear that cryptocurrencies like Monero and Particl will face mounting attacks.
Decentralized Trading Exchanges: The Ultimate Refuge
Fortunately, truly decentralized trading exchanges (DEXs), which can operate independently of third-party interference or artificial restrictions, serve as safe haven against any anti-freedom clampdown on cryptocurrencies. Monero's widespread availability on these platforms is critical not only for its survival, but also for the preservation of our human rights.
However, the absence of programmable outputs in Monero has been a long-standing challenge when integrating them into these platforms. This situation has resulted in Monero having one of the lowest presences amongst popular cryptocurrencies on such decentralized exchanges. The arrival of adaptor signature-based atomic swaps initiated a change, but until now, the inability to execute bidirectional atomic swaps posed an understandable but significant barrier to the Monero community's extensive use of atomic swaps.
The integration of bidirectional Monero atomic swaps into the BasicSwap DEX marks a shift in this scenario, reinforcing our conviction in the significance of today's announcement.
The Road Ahead
Of course, there’s a lot of work that still needs to be done. For instance, BasicSwap, operating as a local application hosting various blockchains, remains relatively complex to initiate. Even though we've streamlined the setup process with the soon-to-come release of an executable (.exe) installer and launcher, the resultant user experience still falls short when compared to centralized exchanges — although, once set up, it operates in remarkably similar ways.
This fact underscores our recent emphasis on developing a web framework that will equip BasicSwap to deliver web services and power decentralized trading platforms on the web. With this major headway, platforms will be able to harness BasicSwap's unparalleled decentralization and uncompromising privacy without having to run a local application, synchronize chains, or deposit coins into web wallets.
While this major upgrade is still under construction, the launch of bidirectional Monero atomic swaps on BasicSwap today frees up more resources for the development of this crucial web infrastructure, making it now our prime focus moving forward.
We encourage you to stay tuned to our blog at Particl News for updates on this topic. If you're interested in contributing to enhancing the resilience of Monero and other cryptocurrencies, visit Particl's BasicSwap Youtube playlist or its Particl Academy section to get started and contribute to its liquidity!
If you would like to deepen your understanding of atomic swaps and their history, make sure to give these articles a read!
The Open-Source Revolution
We're on a mission to create a private, independent, and pro-liberty digital economy that is fair and open to all. Learn more about what we do at any of the following links.
Be a part of the movement and join us in the fight for our freedoms by meeting the community and spreading the word far and wide!
Learn more about Particl with these in-depth resources.
Follow the link below to get a list of all other useful Particl-related links you may find helpful.