|
December 24, 2013, 12:36:33 PM |
|
So, I'm not an expert on bitcoin, but I've been writing software professionally for 14 years... and if you're planning on making a website that handles peoples money, you need to be rock solid with your dev skills. You sound sound like you're having some difficulty with some of the basics, so maybe start with something a little less ambitious? I'm really not trying to be mean, just trying to be helpful and realistic.
The way I would imagine most gambling websites work is, you deposit coins into one of their addresses. After they are confirmed (no website should let you use coins before they're confirmed), they record your tally in a row in the DB. From this point on, your "balance" is entirely virtual and has no relation to any real wallet. Wins and losses are recorded in the database (likely there's a transaction log so they have accountability if someone says their account is wrong), and they update a boring old account_balance for you. You don't need to calculate the value based off the transaction log, that's processor and database-heavy and unless you have a bug, should never be different than the constantly-updated balance.
You have to be really really careful not to let people spend more than they have.... it'll almost certainly be a common occurrence that people will bet down to their last satoshi, and might be participating in multiple games at the same time. You have to make sure that they can't bet .5btc on two different games at the same time if they only have .5btc left, you know?
Making a gambling website is a lot of work, you're dealing with someone's actual money, so you have to be super extra careful not to mess anything up. I admire the spirit and ambition, but it's probably not something one person should try to write by themselves.
|