Author

Topic: Account-Address association and effect on account balance (Read 557 times)

newbie
Activity: 38
Merit: 0
If you don't use "sendfrom" and indicate which account you are sending from, then I think it updates the default account.  I could be mistaken on this, so you should probably do some testing on testnet to be sure.

If I'm right, then the default account will have a balance of -0.5 BTC (since it had 1 BTC, and you sent 1.5 BTC), and account "A" will have a balance of 1 BTC.


I tested this and you are correct. Invoking sendtoaddress with a balance larger than the default account has available results in a negative balance in the default account.

It turns out this is in fact documented at https://en.bitcoin.it/wiki/Accounts_explained#Accounts_and_Receiving_Addresses

Quote
- 'sendtoaddress' always succeeds if there are sufficient funds in the
   server's wallet.  For example, if your wallet account balances were 100 BTC in account
   'foo' and 0 BTC in the default account, then the balances after sendtoaddress
   1PC9aZC4hNX2rmmrt7uHTfYAS3hRbph4UN 10.00 would be 100 in account 'foo' and -10.00 in
   the default account (and the overall server balance would go from 100 to 90 BTC).  On
   the other hand, using 'sendfrom' to send from the default account with a zero balance
   will fail with message "Account has insufficient funds".
newbie
Activity: 38
Merit: 0
If you don't use "sendfrom" and indicate which account you are sending from, then I think it updates the default account.  I could be mistaken on this, so you should probably do some testing on testnet to be sure.

If I'm right, then the default account will have a balance of -0.5 BTC (since it had 1 BTC, and you sent 1.5 BTC), and account "A" will have a balance of 1 BTC.


OK, I'll try this on testnet and post the results here (my testnet blockchain is still building right now :-( )
hero member
Activity: 836
Merit: 1030
bits of proof
Sorry I have mistaken your "accounts" for addresses.

I am not a user of the reference client, therefore did not realize the context.
legendary
Activity: 3472
Merit: 4801
I'm a little confused about how account balances work.

Assume the following sequence:
  • the default account ("") already exists and has a balance of 1 BTC
  • a new address A is created and associated with account "A"
  • 1 BTC are are sent to address A; the balance of account "A" goes from 0 to 1 BTC; the wallet balance is now 2 BTC
  • 1.5 BTC are spent from the wallet; the wallet balance is now 0.5 BTC

What is the balance of account A at this point?

My understanding is that any inputs in the wallet can selected at any time for spending, including those associated with address A (and thus indirectly with account A).

Will the balance of the account remain unchanged (1 BTC) in this situation?

If you don't use "sendfrom" and indicate which account you are sending from, then I think it updates the default account.  I could be mistaken on this, so you should probably do some testing on testnet to be sure.

If I'm right, then the default account will have a balance of -0.5 BTC (since it had 1 BTC, and you sent 1.5 BTC), and account "A" will have a balance of 1 BTC.
hero member
Activity: 836
Merit: 1030
bits of proof
Do we have an FAQ for this?

Short answer:
There are no balances in Bitcoin at the protocol level.
You spend outputs of previous transactions and not balances.
newbie
Activity: 38
Merit: 0
I'm a little confused about how account balances work.

Assume the following sequence:
  • the default account ("") already exists and has a balance of 1 BTC
  • a new address A is created and associated with account "A"
  • 1 BTC are are sent to address A; the balance of account "A" goes from 0 to 1 BTC; the wallet balance is now 2 BTC
  • 1.5 BTC are spent from the wallet; the wallet balance is now 0.5 BTC

What is the balance of account A at this point?

My understanding is that any inputs in the wallet can selected at any time for spending, including those associated with address A (and thus indirectly with account A).

Will the balance of the account remain unchanged (1 BTC) in this situation?
Jump to: