5

Imagine I have 2 UTXOs locked by my address, each of which allows me to spend 5 bitcoins.

If I subsequently want to send just 2 bitcoins to someone else, will both UTXOs be used as inputs in the transaction, where I now receive 8 BTC change as a single UTXO locked to my address, or as the value I want to spend can be covered by a single UTXO, is only one of the 5 BTC UTXOs spent by the transaction and I receive change in a new UTXO worth 3 BTC locked by my address. So now my address locks two UTXOs, one for 5 BTC which was not needed in this transaction, plus the change I just received for 3 BTC. Or something else?

Murch
  • 71,155
  • 33
  • 180
  • 600
  • 1
    As an aside, this question helps exemplify why address reuse is very bad for privacy: the person you pay 2 BTC to will be able to see that you control an address that holds many UTXOs, rather than just seeing the single UTXO that you spent to pay them. So with address reuse, you grant anyone you transact with the ability to see a **much** larger portion of your financial history. – chytrik Mar 07 '19 at 01:01

1 Answers1

4

Transactions explicitly refer to which UTXOs they are spending.

You can construct a transaction which only spends one of the two 5-BTC UTXOs, and sends 2 BTC to the destination and 3 BTC to a (possibly new) address of yourself.

You can also construct a transaction which spends both, and sends 8 BTC back to yourself. Or it could have multiple outputs that send funds back to yourself, summing up to 8 BTC.

In short: there is nothing special about the two UTXOs that share an address, apart from the fact that the same key can sign for both - but it doesn't have to.

Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287
  • Thank you for this clear explanation of the wonderful flexibility of the UTXO model. – Simon O'Hanlon Mar 06 '19 at 23:55
  • Remember to also leave some room for the mining fee as it is, by definition the diff between the utxo set minus the spend tx. `5 utxo = 2btc tx + 2.9 btc tx( change) +(0.1 btc miner fee is not expicited) `. Please, Correct me if I'm wrong, Peter – FKrauss Mar 07 '19 at 17:48