Hello guys,
Lately, I came across the word “CoinJoin” quite a few times and I wondered what it is. So I thought to do a little research to find out what it actually is and how it works. I read a few articles but was only able to understand the high level context of CoinJoin. So I decided to spend some time on it and understand it well enough to create a beginner’s guide so that any person who reads it knows what it is and how it works. I have tried to make this guide as simple as I can to make it beginner friendly.
IntroductionAs we all know, a bitcoin transaction consumes one or more inputs and creates one or more outputs. These outputs are the UTXOs (Unspent Transaction Output) which becomes the input of the next transaction. A standard bitcoin transaction may spend many inputs to get enough value to make the intended payment and this often leads to creating ‘change’ output which goes back to the sender’s address as an unspent output. All of these are visible on the blockchain and any person can look into these transactions to find out the amount that was transferred from one address to another.
Bitcoin addresses are pseudonymous which means privacy can be compromised through reuse of these addresses. This is why it is advised to use a new address every time we make a new transaction. Over the years Blockchain analysis techniques have grown increasingly sophisticated and are capable of linking addresses to identities more efficiently. This is where “CoinJoin” provides a privacy efficient way of making transactions.
CoinJoin was first introduced by
gmaxwell (Gregory Maxwell) in 2013 in his post “
CoinJoin: Bitcoin privacy for the real world “. CoinJoin doesn’t require any softfork because it does not require any changes to the bitcoin protocol.
What is CoinJoin ?CoinJoin is a technique where multiple participants combine their coins into one large transaction consisting of multiple inputs and multiple outputs (including change outputs). Here, an observer cannot determine which output belongs to which input. This makes it difficult for anybody to determine which participant was making a particular transaction. CoinJoin can be applied many times and as many transactions can be grouped together to make it more privacy efficient.
People use Coin Join to protect their privacy and / or anonymity but the level of anonymity they get at the ends will depend on 2 main factors:
1. How they mix their coin with Coin Join transaction (big or small anonymity set)
2. How they use their received coin after the Coin Join transaction (coins post-mix)
- The larger the anonymity set, the better
- The less times you post-mix your coins, the better.
- In case you decide to post-mix your coins, please only mix exactly the amount of UTXOs you want to spend from, not post-mix all UTXOs you get from Coin join transaction.
- Ideally, use each post-mix UTXO for each of your sending transaction
ExampleHere, the anonymity set is the size of the privacy group. I could have explained more on the anonymity set but it will be too technical for a beginner friendly guide. The last 3 transactions are the change output from the 3 inputs. There is no way to determine which transactions from the anonymity set belongs to which input. The only thing an observer can know is that one of the output from the anonymity set is derived from one of the inputs thus increasing the privacy.
CoinJoin transactions
https://blockstream.info/tx/e4a789d16a24a6643dfee06e018ad27648b896daae6a3577ae0f4eddcc4d9174
https://blockstream.info/tx/ef329b3ed8e790f10f0b522346f1b3d9f1c9d45dfa5b918e92d6f0a25d91c7ce
https://blockstream.info/tx/f82206145413db5c1272d5609c88581c414815e36e400aee6410e0de9a2d46b5 How to get started ?The only two production ready platforms are Wasabi wallet and Joinmarket.
Wasabi is an open-source, non-custodial, privacy-focused Bitcoin wallet for Desktop, that implements trustless CoinJoin.
JoinMarket is a CoinJoin implementation aimed at improving the privacy and fungibility of bitcoin transactions.
https://wasabiwallet.io/
https://github.com/JoinMarket-Org/joinmarket-clientserver TipOne input per bitcoin address would be efficient to use for a CoinJoin transaction as reusing the same address damages the privacy. You can consolidate all your small inputs to create one bigger input. LoyceV has created a beautiful thread for this.
[Oct 2020] Fees are low, use this opportunity to Consolidate your small inputs! Sources & References
https://en.bitcoin.it/wiki/CoinJoin#:~:text=CoinJoin%20is%20a%20trustless%20method,paid%20which%20recipient%20or%20recipients.
https://academy.binance.com/en/articles/coin-mixing-and-coinjoins-explained
https://wasabiwallet.io/
Forgive me for any mistakes. Suggestions and feedback are welcome.