3

I studied lots of valuable q&a here, but still I have some doubts.

Case - simple game (calm down - I'm not one of the rookies creating exchange as seen here), which allows to pay for a game. The character of the gameplay forces us to create virtual balance for each player and create payouts on daily basis/request.

What's done:

  • compiled bitcoind client is running on encrypted wallet in background
  • creating in advance pool of addresses
  • assigning free address to registered user
  • listen for incoming transactions/confirmations
  • on 6th confirmation we add transaction to user balance

Where I need guidance / pro advice:

  • strip my runnning bitcoind client with wallet from holding private keys (I've read about it but don't know how to achieve it properly)
  • many guides advice to run bitcoind client on other machine - but how to setup secure communication between two machines (vpn?), if someone gains access to game server, it doesn't matter where client is located (right?)
  • as private keys are stored away, how I can deal with payout requests? Are there known practices in that field? I've read https://bitcoinsecurityproject.org/SecureApplicationArchitecture/, but can't imagine real world example/process

Last but not least - if users send coins to private addresses created in one wallet, which private key should sign a transaction? As you probably see, I'm confused with some "basics" after research here :)

EDIT

I found steps to sign transaction offline (http://people.xiph.org/~greg/signdemo.txt) is it preferable way in real world apps?

1

You're going to be doing some fun stuff if you need a complex system.

The Simple Way

Just use Bitcoind along with it's walletnotify and blocknotify arguments. See here. As soon as you get a walletnotify, store it in a database and make sure txid is unique. Walletnotify fires multiple times throughout a transaction's life. Check the database every block looking for unprocessed transactions that have 6 confirms. Those that do should get marked as "processed" or get deleted from the database.

The Hardcore Way

If you need the functionality like described. Consider using one of the many libraries that implement some Bitcoin features and function. Check out Bitcoinj (java), Libbitcoin (C++), Gocoin (Go), and the many python libraries that can be found through search. These libraries can make it a lot more simple to run a more finely controlled and specialized node.

  • Thanks for the input, we already done incoming payments. I have biggest doubts when it comes to payouts where high security is a must... – spamec Feb 2 '14 at 10:20
  • 1
    My bad, but payouts are hard to game on the Bitcoin side, once you push your transaction it's a done deal. But watch out for stuff like race conditions where a user can send you hundreds of requests in the a small time frame. Make sure your database and code process these atomically. – John T Feb 2 '14 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.