Author

Topic: Multiplicity of addresses in default account when using 'sendtoaddress' (Read 932 times)

legendary
Activity: 1181
Merit: 1018

Thank you very much for the reply, I think that gives me a direction!  Smiley
legendary
Activity: 1652
Merit: 2301
Chief Scientist
The best way to understand reference implementation accounts is to think of bitcoins like real, physical coins.

Like how a bank works:

When you deposit coins in your account, they are credited to your account. And then mixed in with all the other coins the bank gets.
When you withdraw, you get coins from the Big Old Pool of Coins-- not the coins you put in, necessarily.

That said: general consensus among core devs is that the accounts feature should go away. It is not appropriate for "enterprise-scale" multi-user use (never optimized for that case, doesn't do ACID transactions with whatever back-end database you're using for customer information, etc etc etc).

And it doesn't do what most people seem to WANT it to do (act as multiple wallets, keeping coins separate).
legendary
Activity: 1181
Merit: 1018

since the bitcoin call 'sendtoaddress' always debits the default account in the wallet (wiki), which one of the addresses that may be associated with the default account is debited?

It appears to me that if the default account (denominated by the empty string "") is associated with multiple addresses, then the 'sendtoaddress' call would have to choose one of these addresses.

Is this correct?

And if the amount to be sent would exceed the amount in any of the individual addresses associated with the default account, but be smaller than the sum of the amounts in the addresses in the default account, would this result in multiple transactions being sent from the multiple addresses in the default account?



And how would the addresses to be sent from be chosen?


I would be grateful for tips from BTC wallet experts, Thank You!




en.bitcoin.it/wiki/Accounts_explained#The_Default_Account

Account Names

Accounts are named with arbitrary strings; you may use any JSON string other than "*" (JSON strings are sent and returned as UTF-8 encoded Unicode).

Bitcoin creates two accounts automatically: it implicitly creates a default account with the empty string as its name, and it explicitly creates an account named Your Address when a new wallet is created.
The Default Account

The default account is named with the empty string ("" in JSON). Generated coins are always credited to the default account, and the sendtoaddress method always debits the default account.
Accounts and Receiving Addresses

Each account is associated with zero or more receiving addresses, and every receiving address is associated with exactly one account. Coins sent to a receiving address in the wallet are credited to the associated account.

Jump to: