Descending Powers of 2 Coinjoins

Bitcoin Transaction

You got 50 bitcoins from a friend and 23 from another. But now you want to spend 73 bitcoins on alpaca socks. So you create a transaction:


Someone else in the world also wants to make a Bitcoin transaction.

Equal Amount Coinjoins

To solve the privacy issues let’s create equal amount coinjoins where all the users are self spending in a coinjoin before an actual spending transactions would take place.

Powers of 2 Coinjoins


Notice we could achieve more efficient mixes by introducing multiple denominations. We may chose powers of 2 as that results in the smallest number denominations those can be decomposed from each other.


Coin Selection

You have many coins in your wallet. Which ones should you select for mixing? What if you know the currently registered input set and make your decision accordingly?

Binary Representation

Amounts can be represented in binary.

Hamming Weight

Hamming weight of an integer is the number of 1s in its binary representation.

Counting 1s

For fun I’m going to count the 1s in our coinjoin:

Putting It All Together

One could intuitively come up with many coin selection strategies with the discussed binary representation insights, but I think the most important ones would first and foremost try to avoid unmixed changes, then minimize the number of outputs.

  1. To ensure minimum anonymity (by avoiding unmixed changes) a wallet could select coins those have all their 1s covered by the mix’s already registered inputs.
  2. To minimize costs (by minimizing the number of outputs) a wallet could select from the remaining coins with the lowest hamming weight.

Coin Merge

Coin merging is a dirty business, but wallets are getting bloated all the time and everyone will eventually have to do it. How? In coinjoins it’s more private than in normal transactions.

In Conclusion

Some assumptions made here are based on intuition and experience and if we’d to do anything with them, we’d have to have sound reasoning to build on top of them, but for now I had to dump my mind here, because I would hate to forget all this.

 by the author.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store