|
June 24, 2011, 08:22:39 PM |
|
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 bitcoid Account balance will be checked only by bitcoind calls Transaction history checks are trivial CONS: More load on the bitcoin network Lots of transaction fees 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 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
NOTE TO ADMINS: If you find this discussion useful, would you move it to "Project Development"?
|