Title: Bitcoin [ sendtoaddress ] command? Post by: wsxdrfv on May 01, 2018, 10:51:20 AM As far as I know,
If some send bitcoin by this command, [ sendtoaddress ], then wallet decide where to pull bitcoin remaining balance from any inside accounts? Title: Re: Bitcoin [ sendtoaddress ] command? Post by: AdolfinWolf on May 01, 2018, 11:17:26 AM As far as I know, If some send bitcoin by this command, [ sendtoaddress ], then wallet decide where to pull bitcoin remaining balance from any inside accounts? I'm not quite sure what you mean. Do you mean A. What inputs are chosen by the wallet to be spent? Quote from: https://bitcoin.stackexchange.com/a/1078 It uses a multi-pass approach, first trying to use only coins with at least six confirmations. In the next two passes it relaxes these requirements. Within each pass, it tries to minimize the number of transaction outputs claimed and then the amount of change returned. https://bitcoin.stackexchange.com/questions/1077/what-is-the-coin-selection-algorithmNote that all coins in your wallet are considered. In the accounting model that the Bitcoin client uses, specific coins do not belong to specific accounts. Or B. Where the so called "change" goes in case your inputs hold more bitcoin than you want to spend? I believe the change simply gets send to the first adress in your keypool that doesn't hold any balance. If you want to specify where the change goes i think you could use something like Code: changeaddress=yournewchangeaddress Title: Re: Bitcoin [ sendtoaddress ] command? Post by: Xynerise on May 01, 2018, 11:53:54 AM By "account" do you mean accounts with different HD seed & different addresses, or do you mean other addresses in the wallet.
If it's the former then Code: sendtoaddress If it's the latter it just select UTXOs and spends according to the amount being sent. Title: Re: Bitcoin [ sendtoaddress ] command? Post by: wsxdrfv on May 02, 2018, 12:16:02 AM By "account" do you mean accounts with different HD seed & different addresses, or do you mean other addresses in the wallet. If it's the former then Code: sendtoaddress If it's the latter it just select UTXOs and spends according to the amount being sent. So I want to know both cases (HD wallet and old wallet). And account does not need maybe? When exchange's wallet, when issue address to user, attach that user's ID to address. Title: Re: Bitcoin [ sendtoaddress ] command? Post by: Xynerise on May 02, 2018, 02:00:05 AM want to know both cases (HD wallet and old wallet). If you have 2 accounts in bitcoin core, the default account and a new account named "A", and you have 2 BTC in default account but 5BTC in account B.If you use the sendtoaddress command to send any amount of bitcoin, it will always debit the default account whether it has a balance or not. For example if you send 3 BTC using the sendtoaddress command and the default account has 2 BTC balance, the transaction will succeed because Core will choose coins from the other account that has funds but still debit the default account so the new balance for the default account will be -1 BTC. If instead you wish to send 3 BTC from the new wallet B instead then you'd use the Code: sendfrom For example Code: sendfrom "B" 1BitcoinAddress 3 If you wish to adjust the balances of different accounts then use the Code: move Title: Re: Bitcoin [ sendtoaddress ] command? Post by: DannyHamilton on May 02, 2018, 02:52:29 PM If you have 2 accounts in bitcoin core, the default account and a new account named "A", and you have 2 BTC in default account but 5BTC in account B. If you use the sendtoaddress command to send any amount of bitcoin, it will always debit the default account whether it has a balance or not. For example if you send 3 BTC using the sendtoaddress command and the default account has 2 BTC balance, the transaction will succeed because Core will choose coins from the other account that has funds No! This is the type of confusion that happens when people try to use the accounting system in Bitcoin Core instead of implementing their own accounting system. Bitcoin Core will just as likely choose to use bitcoins that were previously received at an account that currently has a 0 (or even negative) balance. Think about this like a bank. Imagine you deposit $200 into YOUR ACCOUNT at the bank, and I deposit $500 into MY ACCOUNT at the same bank. Now imagine that I return the next day and withdraw $200 from MY ACCOUNT. Am I going to get those exact same bills from the bank that I gave them? No. The bank mixes the bills all up internally and stores them all together in a vault without any indication as to which bills were deposited into which account. The account is just a number that is updated when the deposit is made. After that, the actual money has NO CONNECTION to the account at all. When I withdraw $200, I might get some of my original bills, I might get some of your original bills. It doesn't matter. Regardless of which bills I get, MY ACCOUNT will be reduced by the amount that I withdraw. Bitcoin Core accounts work the same way. When you "receive at an account" the account value is increased, but the bitcoins are not in any way tied to that account. When you "send from account", the account value is decreased, but the bitcoins themselves just come from the total bitcoins under the control of the wallet. Some of the bitcoins sent MIGHT be the same bitcoins that were received at that account, some of the bitcoins sent MIGHT have been received at other accounts. It doesn't matter. Regardless of which actual bitcoins are sent, the account that is being "sent from" will be reduced by the amount sent. but still debit the default account so the new balance for the default account will be -1 BTC. Non-default accounts are also allowed to have a negative balance. Title: Re: Bitcoin [ sendtoaddress ] command? Post by: wsxdrfv on May 03, 2018, 07:36:25 AM No! This is the type of confusion that happens when people try to use the accounting system in Bitcoin Core instead of implementing their own accounting system. Bitcoin Core will just as likely choose to use bitcoins that were previously received at an account that currently has a 0 (or even negative) balance. Think about this like a bank. Imagine you deposit $200 into YOUR ACCOUNT at the bank, and I deposit $500 into MY ACCOUNT at the same bank. Now imagine that I return the next day and withdraw $200 from MY ACCOUNT. Am I going to get those exact same bills from the bank that I gave them? No. The bank mixes the bills all up internally and stores them all together in a vault without any indication as to which bills were deposited into which account. The account is just a number that is updated when the deposit is made. After that, the actual money has NO CONNECTION to the account at all. When I withdraw $200, I might get some of my original bills, I might get some of your original bills. It doesn't matter. Regardless of which bills I get, MY ACCOUNT will be reduced by the amount that I withdraw. Bitcoin Core accounts work the same way. When you "receive at an account" the account value is increased, but the bitcoins are not in any way tied to that account. When you "send from account", the account value is decreased, but the bitcoins themselves just come from the total bitcoins under the control of the wallet. Some of the bitcoins sent MIGHT be the same bitcoins that were received at that account, some of the bitcoins sent MIGHT have been received at other accounts. It doesn't matter. Regardless of which actual bitcoins are sent, the account that is being "sent from" will be reduced by the amount sent. Title: Re: Bitcoin [ sendtoaddress ] command? Post by: cashberycoin.com on May 03, 2018, 07:54:40 AM As far as I know, If some send bitcoin by this command, [ sendtoaddress ], then wallet decide where to pull bitcoin remaining balance from any inside accounts? What is your wallet now? Title: Re: Bitcoin [ sendtoaddress ] command? Post by: wsxdrfv on May 06, 2018, 11:45:59 PM As far as I know, If some send bitcoin by this command, [ sendtoaddress ], then wallet decide where to pull bitcoin remaining balance from any inside accounts? What is your wallet now? |