Bitcoin Forum
November 11, 2024, 12:00:02 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Change addresses  (Read 466 times)
ungirt (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0



View Profile
April 22, 2013, 03:30:50 PM
 #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
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
April 22, 2013, 03:40:03 PM
 #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.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 22, 2013, 03:43:05 PM
 #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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
ungirt (OP)
Newbie
*
Offline Offline

Activity: 7
Merit: 0



View Profile
April 22, 2013, 03:52:41 PM
 #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?
condor335
Copper Member
Newbie
*
Offline Offline

Activity: 46
Merit: 0


View Profile
April 22, 2013, 03:56:16 PM
 #5

I disagree reginald.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 22, 2013, 03:56:26 PM
 #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.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
April 22, 2013, 04:10:46 PM
 #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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!