Let's say I wanted to host a site in which
- users create their own accounts
- they deposit bitcoins in said accounts
- a commission of, say, 0.05% is kept of all the bitcoins that are deposited in the site
- users play a competitive game with each other (e.g. chess, or others for more players) for a bet
- the winner gets the full bet
- each user can withdraw their bitcoins any time they want
This, I figure, would be quite hard to get right due to all of the different aspects involved, such as user trust, security and technicalities.
My questions are:
How do current betting sites handle the deposits/withdrawals of bitcoins, and how do they keep a commission out of it?
Any small site could rely on trust and do this in a manual fashion, but I'd assume any professional site does not handle this manually. So, is there an existing library (I'll use Node.js, in case it matters) or third-party service for this? And should the bitcoins be stored in a conventional offline wallet(s)?
And last, is there a way to "prove" that the games are fair in order to establish trust? Are there any legal requirements regarding to this?