say i have a transaction details of one address from blockchain info. is there a more updated heuristics for address clustering ? i.e. if a transaction has 2 output which address belongs to a different entity and which one belongs to the same entity(if there is any) thanks


Many wallet software obfuscate the information about payment and change address in order to protect the privacy of the user. When you see block explorer websites showing addresses in the outputs as change addresses, they are merely guessing as there is no sure shot way of knowing. Some of the techniques used to identify change addresses are below. I have also mentioned the current steps taken to prevent detection of such change addresses.

  • Sending change back to the same address: If you send the change back to the same address from which you are initiating the transaction, then there is high likelihood of that address being a change address. This is mitigated by preventing address re-use.
  • Change goes back to the same address type: If you initiated a transaction from a native segwit address (addresses starting with bc1) to a P2SH address (starting with 3). In some wallets, the change will be sent to the native segwit (bc1) address as that is the default for your wallet, thus leaking which output is the change. This is prevented by making the change address match the format of the payout address in order to mask privacy.
  • Coin selection: Assume you want to make a payment of 5 BTC for your coffee (let's hope that the coffee is that good :-)). Your wallet contains two UTXOs: 4 BTC and 3 BTC. To make a payment of 5 BTC, you will have to use both UTXOs and send 2 BTC change back to yourself. Now, the person looking at this transaction would think that if you wanted to make a 2 BTC payment you would have just used your 3 BTC output and sent 1 BTC as change as compared to using both the UTXOs. Thus it is revealed that the 2 BTC is in fact a change output rather than a payment output. Wallet softwares might create two or more change addresses in order to mask which is exactly the change address, or if multiple UTXOs exist, it will optimally select those UTXOs in order to prevent such leak.
  • Change address is the last output: If you build your transaction in such a way that your payment addresses comes first and change comes last, then it reveals which of the output is a change. For example, Bitcoin Core had a bug years ago, where it would never put change first despite randomization, which for single-payment transactions resulted in a deterministic position of change address (second). To prevent such deterministic ordering of change address in outputs, BIP 69 recommends lexicographical ordering of inputs and outputs. Outputs are arranged in ascending order of the amounts, followed by the scriptPubKey.
  • I don't know of any software that always put change last. The standard intended behavior was always to put the change in a random position. – Pieter Wuille Jul 10 '19 at 13:05
  • @pieterwuille I actually picked that from the BIP 69 'motivation' text. "Many wallets will place spending outputs first and change outputs second, ..." – Ugam Kamat Jul 10 '19 at 13:14
  • Bitcoin Core for a while (years ago) had a bug where it would never put change first despite randomization, which for single-payment transactions resulted in a deterministic position. Perhaps it's referring to that? – Pieter Wuille Jul 10 '19 at 13:19
  • @PieterWuille gotcha. Yeah, may be the case. I'll reword my answer – Ugam Kamat Jul 10 '19 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.