How Does CoinJoin Work in Bitcoin?
CoinJoin works by combining inputs from multiple participants into one Bitcoin transaction. Each participant contributes coins represented by unspent transaction outputs (UTXOs), specifies the outputs they expect, checks the completed transaction, and signs only the inputs they control. Once the required signatures are collected, the transaction can be broadcast.
A coordinator may help participants agree on the transaction, but a properly designed non-custodial protocol does not require that coordinator to hold their private keys. Equal-value outputs are common because they make simple amount-based matching less reliable. CoinJoin is a way of constructing ordinary Bitcoin transactions; it does not modify Bitcoin's consensus rules.
Privacy depends on the protocol, participant behavior, fees, change handling, and what happens to the coins afterward.
