Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bananas on March 23, 2014, 10:30:49 PM



Title: Do you use "account" for multi user systems?
Post by: bananas on March 23, 2014, 10:30:49 PM
Do you use the "account" feature of bitcoin daemon to a multi user/wallet system? If so, tell me how it is going on.

I've been recommended to not do it. But i'm doing extensive tests and it showed no problems.


Title: Re: Do you use "account" for multi user systems?
Post by: Foxpup on March 24, 2014, 01:52:59 AM
What are you trying to do? If by "multi-user system", you mean an operating system with multiple user accounts, then no. On a multi-user system, each user gets their own data directory with their own wallet.dat file. If you mean a system that runs as a single user but is accessed by multiple clients, such as an exchange or online wallet, then you need to define your terms better.


Title: Re: Do you use "account" for multi user systems?
Post by: kjj on March 24, 2014, 04:17:24 AM
Any time the question is "Accounts?" the answer is no.

Not that accounts aren't usable, or useful.  Just that if you are asking questions about them, you don't know enough about them to use them safely.


Title: Re: Do you use "account" for multi user systems?
Post by: bananas on March 24, 2014, 04:09:24 PM
Any time the question is "Accounts?" the answer is no.

Not that accounts aren't usable, or useful.  Just that if you are asking questions about them, you don't know enough about them to use them safely.

So how to use them safely? I always only get those vague warning like nobody knows...


Title: Re: Do you use "account" for multi user systems?
Post by: bananas on March 24, 2014, 04:14:14 PM
What are you trying to do? If by "multi-user system", you mean an operating system with multiple user accounts, then no. On a multi-user system, each user gets their own data directory with their own wallet.dat file. If you mean a system that runs as a single user but is accessed by multiple clients, such as an exchange or online wallet, then you need to define your terms better.

I mean like an exchange, an online service. where users who signed up can create an account and deposit and withdraw their btc funds at any time.


Title: Re: Do you use "account" for multi user systems?
Post by: kjj on March 24, 2014, 05:10:16 PM
Any time the question is "Accounts?" the answer is no.

Not that accounts aren't usable, or useful.  Just that if you are asking questions about them, you don't know enough about them to use them safely.

So how to use them safely? I always only get those vague warning like nobody knows...

The secret to account safety is understanding when they are updated, and which one is getting updated.

When a new transaction comes in, all accounts are checked to see if the destination address is tagged as an account member, if any are, that account is updated, if none are, the default account is updated.

When a new spend is created, the account explicitly mentioned in the command (which is usually the default account, is updated.

When a move command is executed, the two accounts explicitly mentioned are updated.

The first two big pits that people tend to run into are:

Tagging an address into an account does not update that account with transactions already known.

The coin selector doesn't know or care about accounts.  A spend tagged with account "B" does not necessarily use a transaction that had come in to "B" before.  A spend that redeems a transaction that had come in to account "B" does not update account "B", unless you explicitly mention account "B" in the command.


Title: Re: Do you use "account" for multi user systems?
Post by: fbueller on March 25, 2014, 12:32:13 AM
The accounts system doesn't scale well, and if you begin to move funds between them you'll start to end up with negative balances, so its hard to rely on them.

I wrote a scraper for transactions being paid to addresses I generated from an electrum mpk. There are cleverer ways to set up a service that doesn't involve asking users to blindly send their btc to you.


Title: Re: Do you use "account" for multi user systems?
Post by: bananas on March 25, 2014, 09:06:36 PM
Any time the question is "Accounts?" the answer is no.

Not that accounts aren't usable, or useful.  Just that if you are asking questions about them, you don't know enough about them to use them safely.

So how to use them safely? I always only get those vague warning like nobody knows...



The coin selector doesn't know or care about accounts.  A spend tagged with account "B" does not necessarily use a transaction that had come in to "B" before.  A spend that redeems a transaction that had come in to account "B" does not update account "B", unless you explicitly mention account "B" in the command.

I understand a spend does not consider accounts, but is not the account balance always updated as if the spend was from the specified account?

sendfrom    <fromaccount> <tobitcoinaddress> <amount> [minconf=1]

As far as the accounts balances are always correctly updated, it is not an issue to me where coins actually come from.



Title: Re: Do you use "account" for multi user systems?
Post by: bananas on March 25, 2014, 09:09:45 PM
The accounts system doesn't scale well, and if you begin to move funds between them you'll start to end up with negative balances, so its hard to rely on them.



How would i end up with negative balances? I  know it can get negative is the wallet(but not the account) has funds. But is not it just a matter of checking the account balance before doing any related transaction? like if $withdrawvalue > $accountbalance do not allow move/send.


Title: Re: Do you use "account" for multi user systems?
Post by: Abdussamad on March 25, 2014, 10:32:13 PM
The accounts system doesn't scale well, and if you begin to move funds between them you'll start to end up with negative balances, so its hard to rely on them.



How would i end up with negative balances? I  know it can get negative is the wallet(but not the account) has funds. But is not it just a matter of checking the account balance before doing any related transaction? like if $withdrawvalue > $accountbalance do not allow move/send.

If you have to do that in your application then why use bitcoind accounts at all? Make up your own accounts system.