💡How does it work?

CLI and web app use the old approach right now in which inputs are registered first and SIGHASH_ALL is used.

Old approach was to register inputs first, followed by outputs. A PSBT was created and signed later by all participants. SIGHASH_ALL or default SIGHASH flag was used in this process. New approach uses ALL| ANYONECANPAY SIGHASH flag and outputs are registered first. This reduces some steps and its implemented in the electrum plugin for joinstr.

Coinjoin with less steps using ALL|ANYONECANPAY

https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-May/021696.html

The process is simple and involves only 3 steps because we have used SIGHASH_ALL | SIGHASH_ANYONECANPAY sighash flag. All the users publish a new address in the first step for output registration. It is followed by publishing PSBT which has 1 input and all outputs signed with ALL | ACP. These PSBTs are combined, finalized and broadcasted. Coinjoin transaction ID is also published as a nostr event in the end by all participating joinstr clients used by different users in a round.

5 users can participate in a coinjoin round at present and denomination or pool amount is hard coded with 0.01 for testing. Although both will be configurable in future when joinstr is ready for mainnet so that users have to freedom to create pools with custom amounts.

Costs

All users pay equal fees in every round which in total is used for transaction fees. Only 1 transaction is required for coinjoin and fees depends on the mempool at that moment. Each user would pay approximately 2000 sats if 10 sat/vbyte fee rate is used for the coinjoin transaction. Participants can also use paid nostr relays although there needs to be at least 1 common relay between the participants for coordination to work properly.

Privacy

Every step involves publishing a nostr event and a new public/private key pair is used for it to improve privacy. New IP address can also be used for each step using tor circuit however RiseupVPN API will be used in joinstr.

Security

DoS vectors can be reduced by using encrypted nostr channels for each round and encouraging users to try paid, private, custom nostr relays.

Last updated