Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bitlotto on May 04, 2012, 08:06:08 PM



Title: Addresses for BTC change
Post by: bitlotto on May 04, 2012, 08:06:08 PM
Is the change address always one bitcoin address per tx? I'm interested in the satoshi client as well as any others out there. Do any clients return change to multiple similar addresses?

What I'm specifically looking for is say someone spent:
1 BTC to address A.
.1 BTC to address B.
.1 BTC to address B.
In one tx

When I look at the tx output can I safely assume that address B is NOT an address used for change but part of a payment somewhere?


Title: Re: Addresses for BTC change
Post by: Stephen Gornick on May 04, 2012, 09:37:27 PM
Is the change address always one bitcoin address per tx? I'm interested in the satoshi client as well as any others out there. Do any clients return change to multiple similar addresses?

What I'm specifically looking for is say someone spent:
1 BTC to address A.
.1 BTC to address B.
.1 BTC to address B.
In one tx

When I look at the tx output can I safely assume that address B is NOT an address used for change but part of a payment somewhere?

The Bitcoin.org (Satoshi) client would pull an unused address for the change.  If you were to explicitly add as an output the next address so that it would match the same one the change would go to, I suppose the client isn't set up to detect that as a used address and you technically could end up with the transaction looking like above, where B is both a payment address and one used for change in the same transaction.  But that would require you to explicitly choose that address.

Other clients let you choose what addresses the change goes to, so yes -- the above can occur if you explicitly choose for it to happen that way.


Title: Re: Addresses for BTC change
Post by: bitlotto on May 04, 2012, 09:43:42 PM
Oh, thanks...

Imagine this tx:

input:
Address A 0.4 BTC
Address B 0.9 BTC

output:
Address C 0.1 BTC
Address C 0.1 BTC
Address D 1 BTC
Address E 0.1 BTC

Say we know for sure one of the payments for purchasing was D.

Would C ever be a change address (or would the software have to be modified to do that)? Or would C have to be done manually as 0.1 payments to somewhere?


Title: Re: Addresses for BTC change
Post by: bitlotto on May 04, 2012, 10:10:32 PM
The Satoshi would pull an unused address for the change.  If you were to explicitly add as an output the next address so that it would match the same one the change would go to, I suppose the client isn't set up to detect that as a used address and you technically could end up with the transaction looking like above, where B is both a payment address and one used for change in the same transaction.  But that would require you to explicitly choose that address.

Other clients let you choose what addresses the change goes to, so yes -- the above can occur if you explicitly choose for it to happen that way.
Could we assume that EITHER the person made those two payments in one tx to the same address OR they for sure own that address?


Title: Re: Addresses for BTC change
Post by: Stephen Gornick on May 04, 2012, 11:17:48 PM
Could we assume that EITHER the person made those two payments in one tx to the same address OR they for sure own that address?

I believe so.  I can't think of any way else that such a transaction would occur.