CoinSwap is a decentralized protocol that would allow cryptocurrency users to directly and privately exchange their coins. That is, no intermediary of any kind participates, except for users interested in the exchange. 

Unot of the main objectives of the cryptocurrencies is to offer tools that protect our privacy, and in the midst of pursuing that goal, CoinSwap stands as a useful tool to achieve it.

And is that CoinSwap, is a protocol that seeks to provide the ability to obfuscate and hide information about cryptocurrency transactions that are carried out in your chain of blocks. And with this it seeks to offer a level of privacy and anonymity that exceeds that of tools such as the coinjo.

CoinSwap, a protocol designed to facilitate decentralized exchanges

CoinSwap is a cryptocurrency exchange protocol designed with the aim of creating a cryptocurrency exchange platform in a decentralized way. The idea behind CoinSwap closely resembles the atomic swap or atomic swaps that allow on-chain exchanges quickly and without custody. However, CoinSwap is much simpler and more flexible than swap atomics and therefore emerges as a much easier working solution to develop.

The design and initial idea of ​​CoinSwap was born in 2013, when Greg Maxwell, recognized Bitcoin Developer presents on the Bitcointalk forum his topic: CoinSwap: Transaction graph disjoint trustless trading (CoinSwap: disjoint transaction graph for trustless trading).

At that time, Maxwell's idea was to create a cryptocurrency exchange protocol that could be applied to Bitcoin without the need to alter its current protocol. In this sense, Maxwell took ideas from coin mixers and P2PTradeX by Sergio Dan Larimer, to create a new secure, non-custodial and above all private exchange system, CoinSwap was born.

As a result of Maxwell's work, CoinSwap was transformed into a protocol that enabled decentralized cross-coin P2P trading. This means for example that someone can use CoinSwap to exchange their Bitcoin by Bitcoin Cash, without any intermediary, without using a DEX, using only their wallets with CoinSwap support.

However, despite the enormous usefulness of this idea, there is still no working implementation of CoinSwap at present. In fact, it was only in 2020 when Chris Belcher, presented what would be the first complete technical implementation of this system.

How does CoinSwap work?

CoinSwap basically works around two users looking to exchange their cryptocurrencies, performing cryptocurrency operations within their respective blockchains. To make this exchange a reality, CoinSwap makes use of schemes multi-signatures of the 2-of-2 type. This means that the exchange participants must cryptographically sign the transaction for it to take place, and once this is done, neither party can manipulate the transaction alone.

Additionally, during the transaction process CoinSwap allows the two users to exchange their cryptocurrencies, without a third party being able to establish a relationship between the parties involved in the exchange. And the best, without this meriting changes in the Bitcoin protocol for this process to take place.

For example, María and Luis can exchange their cryptocurrencies using CoinSwap. Maria wants to mix 10 BTC and Luis wants to mix the equivalent in BTC as well. When Maria and Luis create a CoinSwap operation, they must both create a 2-of-2 multi-signature address where the funds in question will be arranged.

However, in the interest of improving anonymity, CoinSwap transactions will be done in several stages. So the following would happen:

As we can see, the exchange of the 10 BTC between María and Luis has been carried out in 6 total operations. In these operations, it can be seen that Maria sent 10 BTC to an address, and from there 10 BTC reached Luis. On the other hand, Luis's 10 BTC reaches María in 5 different operations that add up to the exchange's 10 BTC, complicating the way of establishing a relationship between María and Luis, due to the participation of the intermediate CoinSwap address.

However What tools make all this possible? Well, let's get to know the basic elements, which make the operation of CoinSwap possible.

ECDSA-2P, a signature algorithm with privacy in mind

An important point in the operation of CoinSwap is given by the multi-signature addresses that are created by the parties involved in the exchange. Two things depend on these addresses:

  1. The security and decentralization of the process, to prevent a bad actor from seeking to misappropriate the funds.
  2. The privacy of the process, by showing that the address in question is any address.

This is where ECDSA-2P or two-part ECDSA comes into play. This signature algorithm is used to create 2 out of 2 multiple signature addresses that look the same as regular single signature addresses. In fact, ECDSA-2P allows musig addresses to be even legacy or P2PKH addresses (those that start with 1). This has a great impact on privacy since the bulk of Bitcoin addresses are under this format, which would make its analysis much more complex.

ECDSA-2P qualifies in what we know as threshold signatures (Threshold Signature) of the bipartite type, which is closely related to the Shamir scheme of secrets (SSS). This system was proposed by Yehuda Lindell from Bar-Ilan University, and was proposed thanks to a powerful characteristics of the same: the resulting signatures are verifiable using the original algorithm and without modifications of ECDSA, and all this, because an ECDSA-2P signature is identical and just as valid as an ECDSA signature.

This feature is what allows CoinSwap multisig addresses to be unique: they can perfectly pass through any address and transaction, without any heuristic or cryptographic relationship between the parties involved in their creation. Simply put, a CoinSwap ECDSA-2P address cannot be related in any way to any of its creators, being perfectly private.

Liquidity market

Another important point in the operation of CoinSwap, according to Belcher's implementation, is that it seeks to exploit the best of one of its creations: JoinMarket. The idea is simple, create a liquidity market for CoinSwap and that said market serves to add a greater layer of usability, privacy and anonymity to the final result of operations.

With this, anyone can start a CoinSwap without having to previously enter into an agreement with another person. It only makes the request for the CoinSwap and this liquidity market responds to the request by offering an exchange or exchanges in favor of the amount that the applicant wishes to exchange.

How much do you know, cryptonuta?

Is CoinSwap a common feature in the crypto world?

FALSE!

At the moment, CoinSwap is a desired but not implemented feature in the world of cryptocurrencies. Most of the current protocols that allow exchanges have a control point (centralized or not) that allows users to join together so that they carry out the exchanges. In fact, the closest to reality implementation of CoinSwap is currently abandoned. 

Privacy, the main objective of CoinSwap

CoinSwap is designed to offer high-level privacy and anonymity in your operations. In this sense, the protocol has thought of several functions to make this objective a reality. Thanks to this, CoinSwap has the following capabilities:

  1. Avoid correlation of quantities between its parts. In order to prevent blockchain analysis tools from establishing a relationship between the parties thanks to the identical amounts of operations, CoinSwap is capable of performing various operations in order to avoid this vulnerability. Basically, what it does is that if someone wants to change 10 BTC (like our previous example) those 10 BTC will be sent to us in several operations, in order to break with that correlation scheme of operations and amounts. In this way, no analysis will be able to establish a relationship between our operations and our privacy will be guaranteed.
  2. No single points of trust. CoinSwap has been designed to be a completely decentralized protocol where the only parties involved are those who perform the exchange.
  3. Combining multiple transactions with routing. Routing and multi-transaction should be combined for the best possible privacy.
  4. Breaking the exchange output and CoinJoins wallet fingerprint heuristic. One of the biggest shortcomings of CoinJoin is that it can leave behind a unmixed change or Doxxic Change, which would serve to establish a relationship between the coin mix and the CoinJoin user. However, CoinSwap does not have this flaw thanks to participants sending their change to an address they have used before. That will make the heuristic think that the actual change address is actually the payment address, and the actual payment is actually the change. Thus, it is avoided that relationships can be established between the participants using these changes.

Pros and cons of CoinSwap

Now, certainly CoinSwap presents several pros and cons as a technology and protocol applied to Bitcoin and other cryptocurrencies. In that sense, as its pros we can highlight:

  1. Its very high level of privacy, which rivals and even exceeds that of CoinJoin, by solving several problems of the latter.
  2. CoinSwap operations are more difficult to track. This is because these would not differ in any way from a normal cryptocurrency transaction.
  3. Its ability to make not only changes of the same currency, but also between different currencies (cross-chain) and all this in a decentralized way, P2P and without the need for decentralized exchanges (DEX).
  4. It is a system that does not require changes over the Bitcoin protocol, and is easily adaptable to other derivative cryptocurrencies.

On the negative side, we can mention:

  1. It is a highly interactive protocol, the operations between the parties are multiple, and this requires additional bandwidth over the network.
  2. It depends on whether the information on the participants' nodes is accurate. If the nodes for some reason are not well synchronized or are even victims of some attack, a CoinSwap might not be entirely safe.
  3. Due to its high interactivity, if one of the parties is unable to respond in time to requests for information, there could be a risk of loss of funds on the CoinSwap. This is because the exchange process has a timeout for the execution of actions. Due to this, if the expected response is not given in that period, the theft of funds is possible. This is a weakness that is in the process of being addressed.