Author

Topic: Change addresses (Read 467 times)

legendary
Activity: 3472
Merit: 4801
April 22, 2013, 11:10:46 AM
#7
- snip -
it takes the entire balance from all the addresses in the wallet, and then puts the change either in a new address or one of the existing ones? So every time you send some bitcoins, all the remaining coins from various addresses in that wallet end up in one address?

No.  The wallet will choose a set of previously unspent outputs to spend.  That set may be every output in the wallet, but it also may just be a subset of unspent outputs.

In your example, it is possible that the wallet will spend four of the five 1 BTC outputs, and send 0.5 BTC as a new output to a change address.  It is also possible that a wallet could choose to spend all five of the unspent outputs and send 1.5 BTC as a new output to a change address.

Note that if four of the unspent outputs are chosen, and the 0.5 BTC "change" is sent to the remaining address that already has a 1 BTC output, that address now has 2 separate outputs (a 1 BTC output and a 0.5 BTC output) that can each be spent in a future transactions individually.  On the other hand, if all five outputs are chosen, and the 1.5 BTC "change" is sent to an address, than address now has a single 1.5 BTC output that must be spent in full in some future transaction.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
April 22, 2013, 10:56:26 AM
#6
All UTXOs need to be spent *in full* (if not then the remainder is *fees*) so yes the client can only do one of the two.
copper member
Activity: 46
Merit: 0
April 22, 2013, 10:56:16 AM
#5
I disagree reginald.
newbie
Activity: 7
Merit: 0
April 22, 2013, 10:52:41 AM
#4
Every wallet handles the situation differently, so you'll get better responses if you specify MultiBit in your Subject line.

I've used MultiBit as an example but to be honest I'd be interested in knowing how the different wallets handle it differently.

Quote from: CIYAM Open
Like Danny I am not up with MultiBit but basically it has only two choices wrt change.

1) Create a new address and send it there (which is how the Satoshi client behaves)

2) Send the change back to one of the existing addresses (I guess this should be easily verifiable by experiment).

Ah OK, that makes sense - thanks. So am I right in assuming that irrespective of what choice the wallet makes, in terms of my example above it takes the entire balance from all the addresses in the wallet, and then puts the change either in a new address or one of the existing ones? So every time you send some bitcoins, all the remaining coins from various addresses in that wallet end up in one address?
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
April 22, 2013, 10:43:05 AM
#3
Like Danny I am not up with MultiBit but basically it has only two choices wrt change.

1) Create a new address and send it there (which is how the Satoshi client behaves)

2) Send the change back to one of the existing addresses (I guess this should be easily verifiable by experiment).
legendary
Activity: 3472
Merit: 4801
April 22, 2013, 10:40:03 AM
#2
Every wallet handles the situation differently, so you'll get better responses if you specify MultiBit in your Subject line.

I really haven't learned much about the inner workings of MultiBit yet, so you'll have to wait for someone else to stop by.
newbie
Activity: 7
Merit: 0
April 22, 2013, 10:30:50 AM
#1
I'm sure this has been asked before... but this is the newbie forum right? Can someone explain to me how change addresses work?

So lets say I have a wallet in multibit with 5 addresses and 1 BTC has been sent to each address. An address is one key pair right, so essentially each of the private keys has 1 BTC... I think?

So now I send someone 3.5 BTC. What happens? Am I left with one address with 1 BTC and another address with 0.5 BTC, if so how does Multibit decide what addresses to take the coins from? Or am I left with one address with 1.5 BTC and all the others empty, if so how does multibit decide which address is the "change address"?

Huh
Jump to: