Title: Help me clarify something? Post by: PieStick on April 25, 2013, 02:38:37 AM I am still a little confused about 'addresses'. If I have a wallet with BTC2.00 spread across 4 different addresses (0.50 in each) and I send BTC0.75 to somebody else, are 2 of my addresses randomly emptied and then BTC0.25 sent to a new change address?
Can addresses be split up into separate wallets, or do they share the same private key(s)? Title: Re: Help me clarify something? Post by: sanga on April 25, 2013, 03:39:47 AM In the original client, when you make a transaction, it takes money from "wherever there is funds." I don't know how the decision is made as for what address the funds are taken from, but:
Let's say you received have 10 BTC on one address, say address "1addressIrecieved10BTCon" then you send 2 BTC to "1addressIamSending2BTCto". Therefore, 10BTC are taken out of "1addressIrecieved10BTCon", 2BCT are sent to "1addressIamSending2BTCto", 8BTC are sent to a "change" address, say "1addressInMyWalletButHiddenFromMyView" This means that the address you took funds from, i.e. "1addressIrecieved10BTCon", is now empty, while the 8 BTC that are still available for you to spend are in a change address that actually belong to your wallet, but that you will not see directly in the bitcoin client. If your funds are spreader over multiple addresses, I DO NOT KNOW how it determines what address it will take funds from. My GUESS would be that it merges the smallest amount until it reaches the amount you want to spend, though it would make sense for it to tend to avoid spending funds from transaction that received fewer confirmations. One sure thing is that the only control you have over where funds are taken from and where they are going is limited to the one address you wish to send funds to, and the amount that will be send to that address. Where the funds come from and where the change goes is out of your hands, unless you know how to use the command lines to "micro-manage" your transaction, or have a client that will allow you to do it. If you are comfortable enough, you can go in "Help -< Debug" (menu) and then in the "Console" tab and type "help". You will see the commands available. You can then use the "sendmany" command in order to select the address you want to send funds to and the "account" you want to take the funds from. The "account" (which is neither a wallet, nor an address) should match the label, but change (e.g. the 8 BTC above) addresses could have been created in the same "account". The funds would then be spitted over many addresses, but under the same "account" (or label), so the "coins" would still have come from that same first address, although the funds will have moved through intermediate address in the process. An account is a subset of addresses withing a wallet. An account may contain only one address, or many. Another workaround would be to create separate wallets and send the amounts you want to each wallet, then decide which wallet you want to spend from, but I almost get upsets just to think about that idea. I hope that helps. Title: Re: Help me clarify something? Post by: PieStick on April 25, 2013, 05:07:26 AM Thanks!
Title: Re: Help me clarify something? Post by: HumpNRun on April 25, 2013, 05:15:30 AM I am still a little confused about 'addresses'. If I have a wallet with BTC2.00 spread across 4 different addresses (0.50 in each) and I send BTC0.75 to somebody else, are 2 of my addresses randomly emptied and then BTC0.25 sent to a new change address? Can addresses be split up into separate wallets, or do they share the same private key(s)? yes, but that's just how bitcoin-qt.exe works, it does not have to work like that / someone could write a different program that say ... sends change to a specified change address instead of making a new one Title: Re: Help me clarify something? Post by: DannyHamilton on April 25, 2013, 05:37:28 AM I am still a little confused about 'addresses'. If I have a wallet with BTC2.00 spread across 4 different addresses (0.50 in each) and I send BTC0.75 to somebody else, are 2 of my addresses randomly emptied and then BTC0.25 sent to a new change address? Can addresses be split up into separate wallets, or do they share the same private key(s)? yes, but that's just how bitcoin-qt.exe works, it does not have to work like that / someone could write a different program that say ... sends change to a specified change address instead of making a new one As HumpNRun said, sanga's description is a pretty good explanation of how the Bitcoin-Qt wallet works. Other wallets (such as Electrum, MultiBit, Armory, and https://blockchain.info/wallet ) handle it differently. The other thing to be aware of is that each output received is tracked and spent separately. If you receive a 5 BTC transaction to an address and then later you receive a 3 BTC transaction to the same address, you don't have 8 BTC combined at that address. You have a 5 BTC output and a 3 BTC output that can each be spent separately. Also any output that is spent MUST be completely spent. So given my example of a 5 BTC and 3 BTC outputs, If you were to create a transaction to send 2 BTC to someone, the wallet would choose one of the two outputs (lets say it chooses the 3 BTC output for this example) to use as an input to the transaction you are creating. Then it would create 2 outputs for your transaction. One would be a 2 BTC output to the address you are sending to, the other would be the change (in this case 1 BTC) that would be sent to an address in your wallet (in the case of Bitcoin-Qt, this would be a new address that the wallet wouldn't bother telling you about). So, you'd still have 5 BTC associated with the original address, and 1 BTC associated with the new change address. If you then created a transaction to send 5.5 BTC to someone, the wallet would spend both of the unspent outputs, including them as inputs to the transaction you are creating (for a total of 6 BTC), then create 2 outputs. One would be for 5.5 BTC to the address you are sending to, and the other would be for the remaining 0.5 BTC that would be sent back to an address in your wallet (in the case of Bitcoin-Qt, again it would create a new address that it wouldn't bother telling you about. |