Coin Mixing and CoinJoins Explained
Peter
Last Update vor 7 Monaten
Introduction
Bitcoin is often labeled as digital cash, but this analogy has its limitations. When Alice pays Bob ten dollars in cash, Bob has no way of knowing the source of that money. If Bob later gives that cash to Carol, she cannot trace it back to Alice.
Bitcoin operates differently due to its inherently public nature. The transaction history of a specific coin (more accurately, an unspent transaction output or UTXO) can be easily viewed by anyone. It’s akin to documenting the transaction amount and the names of participants on a bill each time it changes hands.However, the pseudonymous nature of a public address means that users' identities are not immediately obvious. Still, Bitcoin is not entirely private. Blockchain analysis techniques are becoming increasingly advanced, allowing for better linking of addresses to individual identities. With additional surveillance methods, a determined entity can effectively deanonymize cryptocurrency users. To address this issue, various techniques to unlink transactions have emerged over time.
Bitcoin operates differently due to its inherently public nature. The transaction history of a specific coin (more accurately, an unspent transaction output or UTXO) can be easily viewed by anyone. It’s akin to documenting the transaction amount and the names of participants on a bill each time it changes hands.However, the pseudonymous nature of a public address means that users' identities are not immediately obvious. Still, Bitcoin is not entirely private. Blockchain analysis techniques are becoming increasingly advanced, allowing for better linking of addresses to individual identities. With additional surveillance methods, a determined entity can effectively deanonymize cryptocurrency users. To address this issue, various techniques to unlink transactions have emerged over time.
What is coin mixing?
In a broad sense, coin mixing can refer to any activity aimed at obscuring the origin of funds by swapping them for others. However, within the cryptocurrency realm, coin mixing usually pertains to a service offered by a third party. These service providers take users’ coins (charging a small fee) and return coins that are not connected to the originals. Such services are often referred to as tumblers or mixers. The security and anonymity of these centralized services are, naturally, a concern. Users cannot be certain that their money will be returned by the mixer or that the returned coins are free from any taint. Additionally, it's important to note that a third party might log both IP and Bitcoin addresses when using a mixer. Ultimately, users relinquish control of their funds with the hope of receiving unlinked coins in return. A potentially more intriguing method is the use of CoinJoin transactions, which offer a considerable degree of plausible deniability. After a CoinJoin, there is no definitive evidence linking a user to their previous transactions. Many CoinJoin solutions present a decentralized alternative to mixers, allowing users to retain custody of their funds, even if a coordinator is involved.
What is a CoinJoin?
CoinJoin transactions were first proposed by Bitcoin developer Gregory Maxwell in 2013. In his discussion, he provides an overview of how these transactions are structured and highlights the significant privacy benefits that can be achieved without requiring any protocol its core, a CoinJoin transaction combines inputs from multiple users into a single transaction. Before delving into the mechanics and rationale behind this, let’s examine the structure of a basic Bitcoin transaction.Bitcoin transactions consist of inputs and outputs. When a user initiates a transaction, they use their unspent transaction outputs (UTXOs) as inputs, specify the desired outputs, and then sign the inputs. It’s essential to understand that each input is signed independently, and users have the flexibility to set multiple outputs directed to different addresses. When examining a transaction composed of four inputs (0.2 BTC each) and two outputs (0.7 BTC and 0.09 BTC), we can make several observations. First, it appears that a payment is occurring—the sender is likely sending one of the outputs to someone while retaining the change for themselves. Since there are four inputs, it is reasonable to assume that the larger output (0.7 BTC) is intended for the recipient. Additionally, we note a missing 0.01 BTC from the outputs, which represents the fee paid to the miner. Another possibility is that the sender aims to consolidate smaller inputs to create a larger unspent transaction output (UTXO) totaling 0.7 BTC.We can also consider that because each input is signed independently, this transaction may involve up to four different parties signing the inputs. This aspect is fundamental to the effectiveness of CoinJoining.
How does a CoinJoin work?
The concept behind CoinJoin is that multiple parties collaborate to create a transaction, each contributing their own inputs and specifying their desired outputs. As all the inputs are merged, it becomes impossible to definitively determine which output corresponds to which user. In the accompanying diagram, we can see four participants who want to obscure the links between transactions. They coordinate among themselves (or through a designated coordinator) to announce the inputs and outputs they wish to include. The coordinator gathers all the necessary information, constructs the transaction, and has each participant sign it before broadcasting it to the network. Once the users have signed, the transaction cannot be altered without becoming invalid, which eliminates the risk of the coordinator absconding with the funds. This transaction acts like a black box for mixing coins. It’s important to note that we effectively destroy the old UTXOs to create new ones. The only connection between the old and new UTXOs is the transaction itself, but we cannot distinguish between the participants. At best, we can infer that a participant contributed one of the inputs and may be the new owner of one of the resulting outputs. However, this is not guaranteed. For example, when examining the transaction in question, we can't definitively say that there are four participants. It could just as easily be one person sending funds to four of their own addresses, two individuals making separate purchases and each returning 0.2 BTC to their own addresses, or four people sending funds to new participants or back to themselves. The possibilities remain uncertain.
Privacy through deniability
The existence of CoinJoin implementations raises questions about the effectiveness of transaction analysis methods. While it may be possible to infer that a CoinJoin has occurred in many cases, it remains unclear who actually owns the outputs. As the popularity of CoinJoin increases, the assumption that all inputs are controlled by a single user diminishes, which represents a significant advancement in privacy within the broader ecosystem In the previous example, we noted that the transaction had an anonymity set of four, meaning any of the four participants could be the owner of an output. A larger anonymity set reduces the likelihood of linking transactions back to their original owners. Thankfully, recent CoinJoin implementations have made it easy for users to merge their inputs with those of many others, offering a high level of deniability. For instance, a transaction involving 100 participants was successfully carried out recently.
Final Thoughts
Coin mixing tools are a valuable addition for any user committed to maintaining their privacy. Unlike proposed privacy enhancements (like Confidential Transactions), these tools work seamlessly with the current protocol. For those who trust the integrity and methods of third-party services, mixing services offer a straightforward solution. However, for users who prefer a verifiable and non-custodial option, CoinJoin alternatives are more advantageous. These alternatives can be implemented manually by technically skilled users or through software tools that simplify the more complex processes. There are already several of these tools available, and their popularity continues to grow as users seek enhanced privacy.