Bitcoin Forum
November 20, 2017, 05:43:46 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: bitcoind - create accounts via API  (Read 2577 times)
btc6000
Member
**
Offline Offline

Activity: 114


View Profile
September 24, 2013, 07: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

We have come to be one of the worst ruled, one of the most completely controlled and dominated, governments in the civilized world—no longer a government by free opinion, no longer a government by conviction and the vote of the majority, but a government by the opinion and the duress of small groups of dominant men.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511199826
Hero Member
*
Offline Offline

Posts: 1511199826

View Profile Personal Message (Offline)

Ignore
1511199826
Reply with quote  #2

1511199826
Report to moderator
1511199826
Hero Member
*
Offline Offline

Posts: 1511199826

View Profile Personal Message (Offline)

Ignore
1511199826
Reply with quote  #2

1511199826
Report to moderator
tgerring
Full Member
***
Offline Offline

Activity: 142


Hive/Ethereum


View Profile WWW
September 24, 2013, 12:43:27 PM
 #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 <bitcoinaddress> <account> 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

Hive, a beautiful wallet for Mac OS X, now available for testing. Follow the story here.
BitcoinKit.framework and Tor.framework, now available to iOS and Mac OS X developers
Tweeting at @hivewallet. Donations appreciated at 142m1MpXHhymF4aASiWwYohe1Y55v5BQwc
CIYAM
Legendary
*
Offline Offline

Activity: 1862


Ian Knowles - CIYAM Lead Developer


View Profile WWW
September 24, 2013, 12:51:26 PM
 #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".

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
tgerring
Full Member
***
Offline Offline

Activity: 142


Hive/Ethereum


View Profile WWW
September 24, 2013, 12:58:49 PM
 #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

Hive, a beautiful wallet for Mac OS X, now available for testing. Follow the story here.
BitcoinKit.framework and Tor.framework, now available to iOS and Mac OS X developers
Tweeting at @hivewallet. Donations appreciated at 142m1MpXHhymF4aASiWwYohe1Y55v5BQwc
icedicedavid
Full Member
***
Offline Offline

Activity: 154


Ice-Dice.com | Massive Referral Bonus!


View Profile WWW
September 25, 2013, 11: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.

knowitnothing
Sr. Member
****
Offline Offline

Activity: 294


View Profile
September 25, 2013, 11: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.

icedicedavid
Full Member
***
Offline Offline

Activity: 154


Ice-Dice.com | Massive Referral Bonus!


View Profile WWW
September 26, 2013, 12:05:20 AM
 #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!

tgerring
Full Member
***
Offline Offline

Activity: 142


Hive/Ethereum


View Profile WWW
September 26, 2013, 03:21:55 PM
 #8

If you're looking for accounts with deposits, `listunspent` works might fine too.

Hive, a beautiful wallet for Mac OS X, now available for testing. Follow the story here.
BitcoinKit.framework and Tor.framework, now available to iOS and Mac OS X developers
Tweeting at @hivewallet. Donations appreciated at 142m1MpXHhymF4aASiWwYohe1Y55v5BQwc
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!