1
I have written a Bitcoin gambling site and am planning on the best approach to host it/manage it securely. The site is implemented in Java using the BitcoinJ API and servlets etc are handled via the Play framework.
Here is an overview of what the site does at high level:
- Communicates to a datastore where "receive/return addresses" inputed by user are stored.
- Creates a unique receive address for the user (also stores this).
- Stores the answers chosen by user.
- Checks for verified transactions and updates datastore with this info.
Finally, when the app has a return address to send winnings to and confirmed verified and confirmed winner, the winnings are sent out.
I am thinking about how to best host this application. Would the best way be to proceed to purchase a dedicated server and run the whole app on there? Are there better/more secure ways that this can be done (also cheaper methods i.e. shared hosting?).
Thanks for your help!
EDIT Potential alternative option:
- Lightweight app on web which communicates directly to a database.
- Database holds a big list of readily created "receive addresses" by a wallet held off server.
- Off server process runs on my PC continuously checking the database for "work".
This approach is probably a lot safer and would also remove the need for a dedicated server. The downsides would be having to run a PC 24-7 at home which constantly checks for work. The off server process would create more addresses when needed and add them to the database (remotely). It would also send out bitcoins to winners and transfer the bulk of BTC to an offline wallet.

Hi Gary, thank you for your answer! I have added an alternative approach to the original post that could be better. What do you think? – Mark – 2013-06-23T18:37:24.930
That alternative (work queue scanner) is a better approach. Your main worries are protecting the private keys and detecting false transactions (compromised server sending/receiving false instructions). Having a supply of pre-generated addresses is a good solution to avoid private keys on the server. When rendering the public addresses ensure no third-party JavaScript is running that could overwrite the values in the DOM. Be paranoid. – Gary Rowe – 2013-06-24T09:24:39.587