Bitcoin Forum
May 03, 2024, 05:22:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Multiplicity of addresses in default account when using 'sendtoaddress'  (Read 918 times)
l8orre (OP)
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
June 27, 2014, 04:31:13 PM
 #1


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.

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714713728
Hero Member
*
Offline Offline

Posts: 1714713728

View Profile Personal Message (Offline)

Ignore
1714713728
Reply with quote  #2

1714713728
Report to moderator
1714713728
Hero Member
*
Offline Offline

Posts: 1714713728

View Profile Personal Message (Offline)

Ignore
1714713728
Reply with quote  #2

1714713728
Report to moderator
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
June 27, 2014, 04:42:09 PM
 #2

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).

How often do you get the chance to work on a potentially world-changing project?
l8orre (OP)
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
June 27, 2014, 04:54:31 PM
 #3


Thank you very much for the reply, I think that gives me a direction!  Smiley
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!