Bitcoin Forum
December 08, 2016, 08:20:56 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Best practices for maintaining many bitcoin accounts on a website [SOLVED]  (Read 1336 times)
coinjedi
Full Member
***
Offline Offline

Activity: 184



View Profile WWW
June 24, 2011, 10:23:34 PM
 #1

SOLVED: It seems that best practices are already listed at https://en.bitcoin.it/wiki/Accounts_explained#Typical_Uses. Feel free to add your further comments and opinions.

I am working on a website running on bitcoin. Users will be able to deposit and withdraw bitcoins, also there will be transactions between users and the site possibly several times a day for each user. I'd like to do some premature optimization and build something that can scale for large number of users. What are the best practices in your opinion? I am considering three options:

1) Always consolidate option: Accounts will be maintained by bitcoind for every user. Every time a transaction happens bitcoins will be moved between accounts.
PROS:
No other background process (More reliable, faster website?)
Simpler database (faster?)
Less code
Incoming transaction confirmations will be handled by bitcoind
Account balance will be checked only by bitcoind calls
Transaction history checks are trivial
CONS:
More load on the bitcoin network (EDIT: WRONG!)
Lots of transaction fees (EDIT: WRONG!)
Performance issues with bitcoind for lots of accounts and transactions?


2) Periodic consolidation option: Every user still has own account in bitcoind. But transaction are stored in the database and committed periodically (once a day?) to bitcoind.
PROS:
Minimal load on the bitcoin network
Less transaction fees (EDIT: WRONG!)
Incoming transaction confirmations will be handled by bitcoind
CONS:
Extra daemon and database to maintain
Account balance checks require both database and bitcoind calls
Withdrawals require extra account consolidations
Transaction history checks might be tricky
Performance issues of bitcoind for large number of accounts?


3) No consolidation option: There will be single account for the whole site, but users will be given unique addresses for deposits. All internal transactions will be maintained in the database. External transactions will be monitored frequently (every minute?) and committed to the database.
PROS:
No unnecessary load on the bitcoin network
No unnecessary transaction fees
Account balance checks will only require a database call
Transaction history checks are trivial (but may be unreliable?)
Better bitcoind performance?
CONS:
Too much load by the daemon (overall performance issues?)
Extra daemon and database to maintain
More code
Issues with incoming transaction validations

Currently I am leaning towards the second option, but please add options, pros, cons or other opinion.
Thanks.

cj

Bets of Bitcoin
http://betsofbitco.in/
1481185256
Hero Member
*
Offline Offline

Posts: 1481185256

View Profile Personal Message (Offline)

Ignore
1481185256
Reply with quote  #2

1481185256
Report to moderator
1481185256
Hero Member
*
Offline Offline

Posts: 1481185256

View Profile Personal Message (Offline)

Ignore
1481185256
Reply with quote  #2

1481185256
Report to moderator
1481185256
Hero Member
*
Offline Offline

Posts: 1481185256

View Profile Personal Message (Offline)

Ignore
1481185256
Reply with quote  #2

1481185256
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481185256
Hero Member
*
Offline Offline

Posts: 1481185256

View Profile Personal Message (Offline)

Ignore
1481185256
Reply with quote  #2

1481185256
Report to moderator
1481185256
Hero Member
*
Offline Offline

Posts: 1481185256

View Profile Personal Message (Offline)

Ignore
1481185256
Reply with quote  #2

1481185256
Report to moderator
riush
Member
**
Offline Offline

Activity: 73


View Profile
June 25, 2011, 04:12:20 AM
 #2

Hi. Sorry if I'm missing something, but why don't you use the 'move' RPC command?

Quote
$ ./bitcoin help move
move <fromaccount> <toaccount> <amount> [minconf=1] [comment]
Move from one account in your wallet to another.

For my online wallet in-development, I'm currently letting bitcoind handle all this stuff and just add extra data in the application database, like custom address labels or transaction verifications.
(http://forum.bitcoin.org/index.php?topic=12403.0 if you are interested in details)

There is also a patch which implements pushing for new transactions/blocks: https://github.com/bitcoin/bitcoin/pull/198

1MKKiJhUJgqKyfCLeo7bB1bvELNEM8wUbz
coinjedi
Full Member
***
Offline Offline

Activity: 184



View Profile WWW
June 25, 2011, 01:48:28 PM
 #3

Hi. Sorry if I'm missing something, but why don't you use the 'move' RPC command?

So what you are suggesting is the first option. I was thinking that, for the network "move" commands are just transactions and require transaction fees. Am I wrong? Do we only pay transaction fees for wallet to wallet transactions?

Also I wasn't sure if bitcoind is good enough to handle many many accounts if the site happens to grow.

Bets of Bitcoin
http://betsofbitco.in/
coinjedi
Full Member
***
Offline Offline

Activity: 184



View Profile WWW
June 25, 2011, 05:15:42 PM
 #4

From the bitcoin wiki:
Quote
Moves are not broadcast to the network, and never incur transaction fees; they just adjust account balances in the wallet.
https://en.bitcoin.it/wiki/Accounts_explained

So I was wrong. This makes the first option more compelling.

Bets of Bitcoin
http://betsofbitco.in/
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!