Making Bitcoin Anonymous Again – With CoinJoin Using Samurai Wallet and Whirlpool

April 5 was Coinjoin day, to celebrate, we tried the Samourai Whirlpool mobile mixing on testnet and spoiler alert it worked. The article is about the what it is and the importance of CoinJoin, the ability to do so using several tools, and how to do it yourself.

Coinjoin is a kind of bitcoin transaction in which few peers participate using their UTXOs (Unspent outputs from Bitcoin transactions OR just bitcoin balance) which enters the system (in this case it is one of the pools in whirlpool) and after a group of transactions using the coinjoin implementation, different outputs are created and nobody should ideally be able to make out which belongs to the which peer that initially spent their UTXOs. I have drawn a shapes diagram below to make it easier for everyone to understand the concept of coinjoin in bitcoin.

Greg Maxwell started the thread on bitcointalk forum about coinjoin back in 2013.

Steps of coinjoin process in Samourai Whirlpool

Tx0 – Premix – Mixing – Postmix – Spend

Why Use CoinJoin?

CoinJoin offers financial freedom, to keep your transactions private and secure, if bitcoin transactions aren’t private, how is it different from fiat currencies where the government, banks etc. can run surveillance.

Bitcoin being an open ledger for anyone to access, a user may leak sensitive information about your identity, your wallet balance, your past transactions and your future transactions to your payers and recipients.

Blockchain analysis companies are already paid to deanonymize, spy and profile blockchain users, leading to payment censorship and affecting Bitcoin fungibility.

How to do a coinjoin?

We used Samourai wallet mobile app to coinjoin.

All the testers created a testnet wallet after installing the app. User can directly do the same with mainnet wallet and real Bitcoin.

Select TestNet or Mainnet based on the requirement on Samourai.

Once the user have created a new wallet and received some BTC in it, they can follow the below steps to use whirlpool coinjoin in samourai mobile app.

Whirpool option on Samurai Wallet

Mix UTXOs on Samurai Wallet.

User will select the UTXO from where the funds are to be used.

Fee selection on Samurai wallet

Select priority and this might be different on the mainnet. I will share some information about fees involved in whirlpool towards the end.

Information about basic things before confirming the cycle to begin including unmixed change left from tx0 outputs.

TX entropy computes the number of possible interpretation of a transaction (high entropy = good privacy)

Entropy density (ED) computes entropy per input/output, this as an efficiency metric regardless tx size. ED(tx) = entropy(tx) / count(tx.inputs + tx.outputs) (high ED = good privacy)

UTXO- Unspent Transaction Output

This is the change which was separated from the coinjoin process initially during tx0 to avoid issues. My personal opinion is that user can spend it later to send to some exchange like bisq or hodlhodl, do XMRBTC or BTC-LN trades to mix and later consolidate in your cold storage at different times in different amounts.

UTXO paired in Whirlpool, waiting for premix

One UTXO enters mixing stage and waits for other 4 peer

A new UTXO with 0.01 BTC from each in post mix state.

Tx0 transaction:

https://blockstream.info/testnet/9eca6a0f1f102545605773368660c52c449278ba31563adb10eb82b2e4b1685b

Post-mix transactions:

https://blockstream.info/testnet/tx/db7d941c3afbc09b875e745ab278aae0aa1e10bdb7035aeba7b0586a7b9900d7

https://blockstream.info/testnet/tx/9ebe22983d8b3de1058b951876bfc9e7594edfae4030f8710527e9651bf95396

https://blockstream.info/testnet/tx/bccd2d5013a614e85c733a6fc55f0239d32ccfb03d455083e96e4e1bce052e80

https://blockstream.info/testnet/tx/2870580f1028fb5a62ca4ba846e8b2152e2dcef889c6a3318f1f8db983350e0d

Post-mix UTXOs:

Example of a tx0 transaction on mainnet:

https://www.kycp.org/#/333f45431e47b9543772013ac83a9b33cc58dc3245ccfd48b972107bb8405c13

https://medium.com/samourai-wallet/knowing-your-coin-privacy-using-kycp-org-7b3b4385d8b

https://oxt.me/ is also a cool bitcoin block explorer which also has graphical views to analyze different transactions



After the post-mix stage you can either keep the UTXOs for remixing in whirlpool for free and increase anonymity every time you join a mixing or spend the post-mix UTXOs to pay someone or use for yourself or send to cold storage using post-mix tools in Samourai. Post-mix usage is more important than mixing itself in my opinion.



Once you complete Tx0 and have your first mix done, in the app you’ll go to the post-mix section. Each UTXO will have an option to be marked as unspendable or spent or sent to whirlpool . The UTXOs will be queued one at a time (to prevent mixing with yourself) and selected at random to participate in additional mixes with new users, who pay the mining fee for the tx.

https://support.samourai.io/article/74-how-to-create-a-stonewallx2-transaction

https://support.samourai.io/article/73-creating-a-stowaway-transaction

Stonewall: A basic transactions that looks like a mini Coin Join on chain.

Stonewallx2: A real mini Coin Join where your friend provides you inputs.

Stowaway: A special transaction which looks like a normal transaction but actually is a mini Coin Join between you and your friend where the real transacted amount is obfuscated on chain.

Ricohet add on to Samurai Wallet

Ricohet is also a good privacy add-on in Samourai Wallet app which adds extra hops to your transaction to make it hard for anyone analyzing your transactions

Fees involved in whirlpool coinjoin:

Fees for Whirlpool bot. Source: Telegram

Whirlpool Entry Fee Example (0.01 BTC POOL)

Whirlpool Entry Fee Example (0.01 BTC POOL)

» FLAT Fee is 0.0005 BTC (5%*0.01BTC)

» FLAT entry fee of 0.0005 BTC paid regardless of BTC mixed

» The more you deposit in single tx0 the cheaper the overall fee as a percentage of mixed BTC

» Total mix fees will be slightly higher including miner fees

Usually 3 free riders are present in a mix. Minimum is 2. Exceptions: the genesis mix of a pool is always 5-0 (no remixers) and the second mix of a pool is always 4-1 (only one prev tx allowed and no 5-0 is allowed after genesis)

One of the important things to consider while using Samourai Whirlpool is Dojo because you should always run your own full node and not depend on others or share information about your wallet transactions with Samourai. More info on Dojo

If you want to run your full node and have other options apart from dojo you can also consider buying a nodl:

Some people think Android is not secure enough to be used for bitcoin related stuff which is a myth because Android phones with stock ROMs and backdoored hardware of Chinese companies can be insecure however you can always use a different kernel, custom ROM, privacy apps, customized hardware etc. Also you can use the Samourai wallet app in any emulator or Google Android Studio to test things. I am working on a website to create an open source self hosted environment for using Samourai Wallet in a browser. Hopefully it will be live soon.

I think the best phone right now in terms of privacy is: pinephone

Samourai wallet links:

Website: https://samouraiwallet.com

Twitter: https://twitter.com/SamouraiWallet

SW Telegram: https://t.me/SamouraiWallet

SW Whirlpool Trollbox Telegram: https://t.me/whirlpool_trollbox

My favourite- SW offtopic aka Memepool (Secret Room): https://t.me/samouraifunny

Always feel free to join the above mentioned groups for any feedback or questions. Everyone from the SW team and people voluntarily contributing are really helpful in things related to Bitcoin, Privacy, Anonymity etc.

You can also check the below mentioned podcasts and videos for understanding Samourai, Privacy and Coinjoin better:

Thanks to everyone who participated: hesh870, nafkz18, x0x00, amiermhc, Ardent_cule, jombie99 and ItsMeLA. Also appreciate the help from one of the Samourai developers, Sarath who is always supportive and helpful in things related to Bitcoin and Coinjoin. Before I explain how whirlpool works and share our experience, I want to give a short description of our group and our goals.

We are a group of people who want to contribute to Bitcoin in different ways with our skills. It’s not sponsored by anyone. We get involved in a lot of things voluntarily to make Bitcoin better and spread the word about it. Recently did a Bitcoin meetup in Bangalore and you can check the details here: http://blr.bitcoinmeetup.info

Telegram: https://t.me/BitcoinOnlyIN

Twitter: https://twitter.com/BitcoinOnly_IN

Discord: http://discord.bitcoinonly.in/

Youtube: http://youtube.bitcoinonly.in/

SoundCloud: https://soundcloud.bitcoinonly.in

Memes taken from @dammkewis_memes

What do you think about Coinjoin, let us know in the comments below