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

<p><strong>The Simple Way</strong></p>

<p>Just use Bitcoind along with it's <code>walletnotify</code> and <code>blocknotify</code> arguments. <a href="https://bitcointalk.org/index.php?topic=203438.0" rel="nofollow">See here.</a> As soon as you get a walletnotify, store it in a database and make sure txid is unique. <strong>Walletnotify fires multiple times</strong> 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.</p>

<p><strong>The Hardcore Way</strong></p>

<p>If you need the functionality like described. Consider using one of the many libraries that implement some Bitcoin features and function. Check out <a href="https://code.google.com/p/bitcoinj/" rel="nofollow">Bitcoinj</a> (java), <a href="https://bitcointalk.org/index.php?topic=30646.0" rel="nofollow">Libbitcoin</a> (C++), <a href="https://github.com/piotrnar/gocoin" rel="nofollow">Gocoin</a> (Go), and the <a href="https://github.com/search?l=Python&amp;o=desc&amp;q=bitcoin%20library&amp;ref=searchresults&amp;s=stars&amp;type=Repositories" rel="nofollow">many python libraries</a> that can be found through search. These libraries can make it a lot more simple to run a more finely controlled and specialized node.</p>

CC BY-SA 3.0
2014-02-02T10:20:34.280Z
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
CC BY-SA 3.0
2014-02-02T20:16:34.577Z
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
CC BY-SA 3.0
2014-02-02T09:13:58.740Z
2014-02-02T09:13:58.740Z
John T
<p>I studied lots of valuable q&amp;a here, but still I have some doubts.</p>

<p>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.</p>

<p>What's done:</p>

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

<p>Where I need guidance / pro advice:</p>

<ul>
<li>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)</li>
<li>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?)</li>
<li>as private keys are stored away, how I can deal with payout requests? Are there known practices in that field? I've read <a href="https://bitcoinsecurityproject.org/SecureApplicationArchitecture/" rel="nofollow">https://bitcoinsecurityproject.org/SecureApplicationArchitecture/</a>, but can't imagine real world example/process </li>
</ul>

<p>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 :)</p>

<p><strong>EDIT</strong></p>

<p>I found steps to sign transaction offline (<a href="http://people.xiph.org/~greg/signdemo.txt" rel="nofollow">http://people.xiph.org/~greg/signdemo.txt</a>) is it preferable way in real world apps?</p>

<transactions><bitcoind><payment><server>
Creating secure architecture and payout process
spamec
# Creating secure architecture and payout process

(Asked by: username_0 on 2014-02-01)

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?

**Tags:** transactions, bitcoind, payment, server


---

## 1 answers

### Answer by username_1 on 2014-02-02. Score: 2 | Accepted answer

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.](https://bitcointalk.org/index.php?topic=203438.0) 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](https://code.google.com/p/bitcoinj/) (java), [Libbitcoin](https://bitcointalk.org/index.php?topic=30646.0) (C++), [Gocoin](https://github.com/piotrnar/gocoin) (Go), and the [many python libraries](https://github.com/search?l=Python&o=desc&q=bitcoin%20library&ref=searchresults&s=stars&type=Repositories) that can be found through search. These libraries can make it a lot more simple to run a more finely controlled and specialized node.

> **Comments:**
> **username_0**: Thanks for the input, we already done incoming payments. I have biggest doubts when it comes to payouts where high security is a must...  
> **username_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.  

---

