What is coin mixing?
The security and anonymity of such centralized services are questionable, of course. Users have no guarantee that their money will be returned to them by the mixer or that the coins returned aren’t tainted in some way. An additional aspect to consider when using a mixer is that IP and Bitcoin addresses might be logged by a third party. Ultimately, users give up control of their funds in the hopes of receiving unlinked ones back.
An arguably more interesting approach exists in the form of CoinJoin transactions, which create a significant degree of plausible deniability. That is to say that, after a CoinJoin, no evidence can link a user with certainty to their previous transactions. Many CoinJoin solutions provide a decentralized alternative to mixers. Though there may be a coordinator involved, users don’t need to sacrifice custody of their funds.
What is a CoinJoin?
Bitcoin transactions are made up of inputs and outputs. When a user wants to make a transaction, they take their UTXOs as inputs, specify the outputs, and sign the inputs. It’s important to note that each input is signed independently, and users can set multiple outputs (going to different addresses).
If we look at a given transaction made up of four inputs (0.2 BTC each) and two outputs (0.7 BTC and 0.09 BTC), there are a few different assumptions we can make. The first is that we’re watching a payment take place – the sender is sending one of the outputs to someone, and returning some change to themselves. Since they’ve used four inputs, the larger output is probably for the recipient. Note that we’re missing 0.01 BTC from the outputs, which is the fee given to the miner.
It’s also possible that the sender wants to create a large UTXO out of smaller ones, so they consolidate smaller inputs to get the desired 0.7 BTC outcome.
Another assumption we can make is based on the fact that each input is signed independently. This transaction could have up to four different parties signing the inputs. And therein lies the principle that makes CoinJoining effective.
How does a CoinJoin work?
The idea is that multiple parties will coordinate to create a transaction, each providing inputs and desired outputs. As all of the inputs are combined, it becomes impossible to say with certainty which output belongs to which user. Consider the diagram below:
Here, we have four participants that wish to break the link between transactions. They coordinate amongst themselves (or via a dedicated coordinator) to announce the inputs and outputs that they would like to include.
The coordinator will take all of the information, craft it into a transaction, and have each participant sign before broadcasting it to the network. Once users have signed, the transaction can’t be modified without becoming invalid. Therefore, there is no risk of the coordinator running off with the funds.
But even that is by no means guaranteed. Who’s to say, when looking at the above transaction, that there are four participants? Is this one person sending their funds to four of their own address? Two people making two separate purchases and returning 0.2 BTC each back to their own addresses? Four people sending to new participants, or back to themselves? We can’t be sure.
Privacy through deniability
The very fact that CoinJoin implementations exist is enough to cast doubt over the methods used to analyze transactions. You can deduce that a CoinJoin has taken place in many cases, but you’re still none the wiser as to who owns the outputs. As they grow in popularity, the assumption that inputs are all owned by the same user is weakened – a massive leap for privacy in the broader ecosystem.
For those that trust the integrity and methodology of third parties, mixing services are an easy solution. For those that prefer a verifiable and non-custodial alternative, CoinJoin alternatives are superior. These can be done by hand for technically-proficient users, or by using software tools that abstract away the more complex mechanisms. Already, there are a handful of these tools that only continue to grow in popularity as users strive for greater privacy.