I understand they use your bet as an input, but what does that mean and how do they do it? Can they use the standard bitcoind as a server against which to run the API from?

  • 2
    They are not running the standard bitcoind. – Stephen Gornick Aug 16 '12 at 20:46
  • How do you know? – Shamoon Aug 18 '12 at 11:59
  • SatoshiDice uses bitcoinj to create its transactions. – jim618 Aug 18 '12 at 17:34
  • Does bitcoinj offer anything that bitcoind doesn't? – Shamoon Aug 19 '12 at 0:51
  • 2
    @Lohoris its not actually obvious. you are making an assumption. would be nice if when you make assumptions that you would attempt to explain – gesell Feb 4 '13 at 18:50

This is oversimplified, but here's one sequence showing a serie of payment transactions:

Miner --> You --> Me --> SatoshiDice --> Me

So you send half a bitcoin to me and I use a client that lets me send it instantly to SatoshiDICE. SatoshiDICE then includes at least part of that payment in their win or loss return payout.

Once your payment to me confirms, then mine to SatoshiDICE can confirm. Once my payment to SatoshiDICE is confirmed, then their payout back to me can confirm.

So if you cheated me and your payment to me was a double spend it will then never confirm (reaching 6 confirmations). And in turn, my transaction to SatoshiDICE will never confirm. And in turn, the SatoshiDICE payout transaction back to me will never confirm.

So it doesn't matter that I saw a payout transaction from SatoshiDICE right away, I can't spend it anywhere until it confirms.

Because even a transaction with one or two transactions can get orphaned due to a block reorg and a double spend attack, even if you see a confirmation that doesn't mean the transaction will clear. That is why, unless there is recourse, only six transactions is the recommended number of confirmations to require.

Here's an example of the transactions for a losing 0.02041833 BTC bet:

You can see the flow visually here:

  • 1
    Wouldn't it be better to use a transaction of a winning bet as an example? – Highly Irregular Aug 17 '12 at 1:13
  • I just tried to find a nice standalone winning transaction that was as easy as the one I had chosen for this but the ones I kept finding were all serial bets (from bots) which introduce confusion. So no, this shows everything that's needed and I don't have a winning bet to show. Sorry. – Stephen Gornick Aug 19 '12 at 16:24
  • Can I send coins the same way as SathoshiDice does using the standard client? – Petr Peller Dec 13 '13 at 18:09

If SatoshiDice paid out as quickly as they possibly could then what say an attacker did the following when sending bitcoins to make a bet:

  1. If the bet wins, the attacker receives the winnings and does nothing further, or
  2. If the bet loses, then the attacker tries to get a double spend of the bitcoins out to the majority of the network. If successful, they essentially get their SatoshiDice bet back.

Even fractions of a second would make a difference to the potential success of such an attack, so if SatoshiDice has, say, a 10 second delay before they payout, then the attack may become virtually impossible to achieve unless the attacker somehow cut SatoshiDice off from the majority of the network (very difficult to achieve).

  • 2
    They could still do it without cutting SatoshiDice off by using a Finney attack. But a Finney attack is expensive enough to launch (risk of losing a mined block) that I don't think there's anything to worry about. – David Schwartz Aug 17 '12 at 23:49

You create a transaction with a Transaction Output ID and they pay you out creating a transaction using that Transaction Output ID as the Transaction Input ID. So if your payment doesn't go through, theirs doesn't either.

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.