Introduction to CoinSwap: A tool for using Bitcoin more privately


Privacy at Bitcoin is a point to be improved from day 1. At that time, even users‘ IP addresses were revealed, but today, eleven years later, although there have been changes and developments, the debate is still alive and the tools to add obfuscation to the network are the order of the day. It is in this evolution that CoinSwap emerges.

In CoinTelegraph en Español we have already talked about CoinJoin, another type of transaction that allows to eliminate the relationship between the sender and the receiver by joining an n number of UTXOs as entries, in the same transaction so that it reaches its destination.

Although there are certain similarities, one of the main guarantees of this new proposal is that it improves the operation of CoinJoin, especially in terms of managing UTXO of the same amount. What is it? How does it work? Where does it come from? We will answer all these questions about CoinSwap.

What is CoinSwap?

„CoinSwap“ is a way to exchange a currency for another currency in a non custodial way. It is closely related to the idea of an atomic swap,“ as described by developer Chris Belcher in GitHub.

In principle, we can say that CoinSwap is a privacy protocol. Despite this imprint, transactions made through CoinSwap look just like any regular transaction.

This means that any entity watching the Bitcoin block chain will be left with less data to distinguish one transaction from another, as is now the case with CoinJoin, which can be recognized because UTXOs are the same size.

Although this way of obfuscating Bitcoin transactions was enunciated by Greg Maxwell in 2013, taking up an idea proposed by Argentine Sergio Lerner in 2012; in 2020 it is Belcher who advances an implementation. The objective is to improve Maxwell’s original idea, adding a series of elements that will allow these transactions to be resistant to the observation of external agents, especially because they look like any other transaction.

How does it work?

The basic principle is that at least 2 entities exchange (swap) their UTXO. However, there is no exchange other than of the unspent entries, and there is no direct interaction between the participants. For this, Belcher proposed a solution similar to that of JoinMarket, of which it is also the creator.

JoinMarket is a liquidity market to perform CoinJoin, one of the several implementations currently available, although with its own operating scheme in which some users are liquidity providers. In the case of CoinSwap, the liquidity provider will include other users interested in receiving fees only for „lending“ their bitcoins so that swaps can occur.

You may be interested in: CoinJoin – know the basics of this type of transaction to make Bitcoin more private

One of the key elements is that no exact transactions are made to arrive at the amounts that are sought to be exchanged. So, in the event that Alice wants to clear 10 Bitcoin Investor using CoinSwap, her counterpart would send the bitcoins to Alice in several transactions until the total is complete. Remember that there are more participants, Caroline, Doug, Edward, etc.

To add more obfuscation, and taking advantage of the new capabilities of the protocol, especially with multi-signature payments, the protocol designed by Belcher uses different UTXOs to complete the amount: Alice would receive 3, 5 and 2 BTCs respectively.

All these operations will be signed as a normal transaction, and thus will be added in the blockchain. In addition, the basic exchange, between Alice and Bob, is based on two separate transactions, which are dependent on each other; that is, neither party involved in a CoinSwap can refuse to return the funds.

In addition, in its design, Belcher proposes that to the original exchange between 2 parties (A ->B), as many „Bobs“ as possible be added. With the same multi-signature and multi-payment structure, make the movement of funds even more obfuscated, so that not even the participants would know whose funds they are (which could happen if only Alice and Bob participated).

CoinSwap’s anonymizing capability is such that even p2wpkh Legacy addresses could be used, and it is a type of privacy enhancement that requires no changes in protocol, a significant element when it comes to modifications to Bitcoin.