Atomic Swap solution for anonymous exchange

SwapOnline Team
SwapOnline
Published in
5 min readJul 8, 2019

Anonymity seems to be the holy grail of cross-blockchain exchanges. Not so many users want to disclose his or her identity, let alone to send scanned ID-copy or the proof of income. Thus, KYC-neutrality is a sine qua non for the proper decentralized multi-chain wallet. But the regulators continue to think otherwise which results in a couple of serious challenges for market players.

KYC vs Exchanges: When Delusions Crash

Some major platforms had worked either with no KYC-restrictions or with very soft requirements in this field. The world-leading exchange Binance can be treated as a textbook example in this regard. For years, they have been one of the among leaders of KYC-neutral projects, along with KuCoin, Mercatox etc. The game changed in Q2, 2019. On February 22, 2019, the Financial Action Task Force (FATF), the top world agency in financial surveillance, came out with a new list of recommendations. The message was unequivocal: KYC-checks of the crypto exchanges must be as strict as they are for interactions of classical financial institutions. It didn’t take long to see the results: by the end of March 2019, it was announced that Binance will be collaborating with cutting-edge KYC-providers. The implementation of KYC by Binance was accelerated after last April’s hack of the exchange, which caused the loss of users funds, API data as well as 2FA codes. So, the well-known agnosticism of Binance is no more: users from 29 countries including the U.S. are geo-locked on the Binance DEX. The restriction started on July 1, 2019. The CEO of Binance, Changpeng Zhao, hinted on Twitter to use VPNs for trading after the restrictions were applied. By the way, those meticulous journalists have already figured out that using VPNs breaks the Binance DEX ToS. Unfortunately, this scheme (KYC-agnostic service applies more checks after the latest regulations imposed) is not new. The same occurred with Poloniex in May and with Bittrex in June. It wouldn’t be an exaggeration to say that in the world of crypto this is the saddest story yet in 2019 — new jurisdiction ideas result in new headaches for teams and traders.

(De?)centralized

This is pretty much the same story with centralization. For a long time, IDEX was considered to be the leader of the decentralized exchange segment. One year ago, after analyzing IDEX smart contracts, crypto enthusiasts , stated that there are some signs of centralization. The tension ratcheted up even higher: in the Summer of 2018 there was a particular discussion on Reddit about the nature of IDEX (de)centralization. As a result, on November 1, 2018, the CEO of IDEX Alex Wearn published a long-winded story discussing the ‘misunderstanding of the word ‘decentralization’, ‘known team’ as the point of centralization, etc. making it clear: his project is centralized. Mr. Wearn invented the term ‘pragmatic decentralization’ but did anyone feel any better?

This discussion correlates with the concern related to the decentralization of cryptocurrencies, in particular — Ethereum, EOS, etc. The last question is much more complicated: the decentralization of blockchain itself sets a couple of philosophical puzzles. But it seems a totally decentralized way to operate has been found.

Serverless libp2p-based protocol as the solution for cross-chain KYC-agnostic decentralized exchange

This solution is powered by instant non-custodial cross-chain interactions, so-called Atomic Swaps. A couple of months after the first commercial swaps, on November 22, 2017, Alexander Noxon, a web developer with 16 years of experience and who was the technical director of DAO.Casino service, formulated and published an algorithm for receiving Bitcoins in decentralized applications that use tokens.This algorithm allowed applications that use the Bitcoin.js software library to receive bitcoins and fiat from all the users quickly using HTML. This excluded the intermediaries as well as the opportunity for parties participating in the exchange to deceive each other. The Swap.online, decentralized cross-chain service was launched in Beta with ETH, BTC in July, 2018. The first ever Atomic Swaps with USDT and EOS ever were presented in September, 2018 (have a look at the code!).

Simple Swap.online BTC ⇔ ETH exchange interface

So, how does this protocol avoid KYC without breaking the law?

The protocol does not store users orders on a server. Each user stores his or her orders and sends them to other users directly via the libp2p pubsub network, which works like an IRC (Internet Relay Chat) — an application-level protocol for real-time messaging.

Figure 1: How the CEXs process orders. Figure 2. How the Swap.online processes orders.

How to create an order?

1. Through the interface, the user selects a pair for exchange and indicates the amount he wants to sell (the amount should be available on his/her wallet).

2. The user’s browser creates a message based on the protocol, signs it with the user’s private key (for identification) and sends it to the libp2p pubsub network

3. The browsers of other users receive the message and add the order to their local copy of the order book.

4. In case someone decides to carry out this order, he sends the message directly to the creator of the order

This task needs a simple and fail-resistive centerless system of messaging. A lot of solutions were analysed, but the only one that works is ipfs pub sub. Previously one central public signal server had been used in ipfs, but now a zero-censorsip, attack-protected tool is being developed.

It is gossipsub (https://github.com/libp2p/specs/tree/master/pubsub/gossipsub) which absolutely suits the stated task.

Thus, disabling the main domain not stop the trades. The usage of libp2p pubsub allows organizing the non-custodial interaction of users without the even slightest involvement of a third party.

Swap.Online Essential Links

Website: https://swap.online
GitHub: https://github.com/swaponline
Telegram: https://t.me/swaponline
Facebook: https://www.facebook.com/Swaponline
Twitter: https://twitter.com/SwapOnlineTeam

--

--