Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: luke.watson on March 25, 2013, 05:25:57 PM



Title: How does Satoshi Dice allow for instant transactions?
Post by: luke.watson on March 25, 2013, 05:25:57 PM
I have made a Bitcoin game which I will want to release.. at some point which will take Bitcoin as payment and allow players to win a prize, like all the best casino games..

But i'd like it to be instant theres not a lot of point having a game which you have to wait 10 minutes each time to play I need a way to make it instant like Satoshi Dice and other similar sites

I understand Satoshi Dice runs on 0 confirmations, is this a safe way to run a game, surely people can double spend their money before the transaction has been confirmed?

I dont really understand how it works so could someone please explain how Satoshi Dice works securely?

I will also need a bit of advice on setting up and IPN so my server knows when a payment has gone through

Cheers Luke


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: Remember remember the 5th of November on March 25, 2013, 05:45:07 PM
It's not impossible dude, but he(SatoshiDICE) has already accumulated enough Bitcoins to replenish anything he loses.


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: deepceleron on March 25, 2013, 06:30:40 PM
0 confirmations are inherently untrustable, SatoshiDice has already learned that through successful double-spends which reclaim gambling bet losses. Very few bets are currently notified of win/loss status before being included in the blockchain - SatoshiDice uses a proprietary formula to determine for themselves what zero-confirmation transactions they think are trustable.


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: elgreco on March 25, 2013, 06:59:30 PM
"The SatoshiDice Bitcoin game operates with zero confirmations, meaning the time it takes for you to send a transaction and receive your winnings is near-instant. Bets are evaluated as soon as the client picks up the broadcast. This is safe because it always builds the answering transaction with the output of your bet transaction. This means a blockchain that does not contain your bet cannot contain the site's answer."


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: gendal on March 25, 2013, 07:05:55 PM
"The SatoshiDice Bitcoin game operates with zero confirmations, meaning the time it takes for you to send a transaction and receive your winnings is near-instant. Bets are evaluated as soon as the client picks up the broadcast. This is safe because it always builds the answering transaction with the output of your bet transaction. This means a blockchain that does not contain your bet cannot contain the site's answer."

The risk SatoshiDice is taking is that you might be employing this strategy:

* If I win, I let the transactions confirm and collect my winnings
* If I lose, I very quickly double-spend the coins I had used in my bet, paying a sufficiently high transaction fee that this transaction is more likely than the original transaction to be included in a block.

This way, I capture my wins and can cancel some (most?) of my losses.

Follow this strategy sufficiently often and it would be net positive over time.

I imagine SD have algorithms that look for this behaviour and cut you off pretty quickly if you try it.

The point is: their "use the output in the input" technique prevents you from double spending winning bets... but, of course, what you really want to do is double spend the *losing* bets!


[Edited - got output and input the wrong way round]


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: elgreco on March 25, 2013, 07:25:19 PM


The point is: their "use the output in the input" technique prevents you from double spending winning bets... but, of course, what you really want to do is double spend the *losing* bets!


Ah... makes sense. Didn't think about it that way. Figured whatever you were doing to trigger the doubles-spend would have to be done before you even got a confirmation of a win. But yea, that does leave room for shenanigans.


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: luke.watson on March 25, 2013, 08:04:20 PM
Okay so 0 confirms = not safe unless you are Satoshi so I wont worry with that, I guess my site cant be instant but I'll have to look into building user accounts so people dont have to pay per game they can buy 5/10 goes and use them whenever...

Which API do people suggest using I've been looking at this one
https://github.com/blockchain/receive_payment_php_demo (https://github.com/blockchain/receive_payment_php_demo) which looks like it would do the job with a bit of editing, is there one that people would suggest over it due to ease of use/personal preference?


Title: Re: How does Satoshi Dice allow for instant transactions?
Post by: farlack on March 25, 2013, 08:24:21 PM
Satoshi dice is only instant for cheap bets.
You bet 1 btc you're waiting like 8 minutes