Author

Topic: bitcoind - create accounts via API (Read 2705 times)

full member
Activity: 142
Merit: 100
Hive/Ethereum
September 26, 2013, 10:21:55 AM
#8
If you're looking for accounts with deposits, `listunspent` works might fine too.
full member
Activity: 154
Merit: 100
Ice-Dice.com | Massive Referral Bonus!
September 25, 2013, 07:05:20 PM
#7
I create a new account for each users I accept deposit from with getaccountaddress

then I have a daemon that checks listaccounts for any deposits.

That is not going to work well with thousands of accounts. Instead, properly use listsinceblock.

The reasoning for this is that making new accounts is something that happens very often, and you won't be receiving deposits from all them, so it makes little sense to use listaccounts for this task.

thats a good point actually, thanks!
sr. member
Activity: 294
Merit: 250
September 25, 2013, 06:53:17 PM
#6
I create a new account for each users I accept deposit from with getaccountaddress

then I have a daemon that checks listaccounts for any deposits.

That is not going to work well with thousands of accounts. Instead, properly use listsinceblock.

The reasoning for this is that making new accounts is something that happens very often, and you won't be receiving deposits from all them, so it makes little sense to use listaccounts for this task.
full member
Activity: 154
Merit: 100
Ice-Dice.com | Massive Referral Bonus!
September 25, 2013, 06:26:10 PM
#5
I create a new account for each users I accept deposit from with getaccountaddress

then I have a daemon that checks listaccounts for any deposits.

If deposit is found, I use move to transfer the balance to the "bank" account and credit the user.

Then the next time listaccounts is called, they will show up as 0.

All outgoing withdraw is sent via move from "bank" account to withdraw address.

Let me know if this helps.
full member
Activity: 142
Merit: 100
Hive/Ethereum
September 24, 2013, 07:58:49 AM
#4
Shameless self-promotion, but this explains some of the reasons why developing against bitcoind can be such a pain.  http://www.ideaexcursion.com/2013/09/18/developing-against-bitcoind/

A couple of tips:

* Use listunspent, not getbalance
* Use Gavin's contrib/spendfrom script, never the `sendfrom` command
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
September 24, 2013, 07:51:26 AM
#3
You should read up about Bitcoin accounts before deciding whether you really want to use them.

Some things to know are that accounts != addresses (even though the API commands are likely to lead you to believe that they are), accounts can end up with negative balances, you can't send BTC "from" the address of an account and "moves" of BTC between accounts are internal wallet operations (i.e. nothing to do with the blockchain).

Also if you are using bitcoin-qt then you are going to end up with a lot of confusion between "accounts" and "labels".
full member
Activity: 142
Merit: 100
Hive/Ethereum
September 24, 2013, 07:43:27 AM
#2
Code:
getnewaddress [account] Returns a new bitcoin address for receiving payments. If [account] is specified (recommended), it is added to the address book so payments received with the address will be credited to [account].
Code:
setaccount Sets the account associated with the given address. Assigning address that is already assigned to the same account will create a new address associated with that account.

And you don't "delete" addresses, they just sit unused

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
member
Activity: 116
Merit: 10
September 24, 2013, 02:31:23 AM
#1
There are a number of bitcoind API commands referring to [account], but how do you create, update & delete named accounts using API?

Cheers
Jump to: