Tell me more ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

Everyone knows what SatoshiDice is. Their core mechanic is gambling through the use of Bitcoin transactions with the payout being directly linked to the transaction that fuelled the bed to avoid double-spend attacks. My question is, how to implement such a mechanism? Can it be done in the Standard Client, or does it need some extra software to pick the exact inputs of a transaction?

share|improve this question

1 Answer

You could easily write a piece of software that runs on the same machine as a bitcoin daemon and let it use the JSON-RPC API from the local bitcoin daemon.

There are JSON-RPC implementation examples for all popular programming languages like Python and Java.

This piece of software will poll for new transactions, validate them and applying your game rules, and again making new transactions. Note that a server with such a piece of software needs only to have it's bitcoin port open to the internet, while the RPC port can be limited to local connections for safety.

share|improve this answer
Well, after attempting to implement it through Bitcoin API, I ran into the problem that since 0.8 and the new database system, bitcoind does not have all information on old transactions, so finding out the sender of a given transaction can be problematic. – ThePiachu Apr 9 at 5:54
How is an "old" transaction defined? SatoshiDice acts fast, right? I guess transaction details should be kept several blocks at least, no? – Steven Roose Apr 11 at 20:24
Well, in order to determine the issuing address using the API, you need to look to a transaction previous to the one gambling, which can be arbitrarily old. – ThePiachu Apr 11 at 22:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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