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

<ol>
<li>If the bet wins, the attacker receives the winnings and does nothing further, or </li>
<li>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.</li>
</ol>

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

CC BY-SA 3.0
2012-08-17T23:49:05.690Z
They could still do it without cutting SatoshiDice off by using a [Finney attack](http://bitcoin.stackexchange.com/questions/1192/would-a-reduced-block-generation-time-make-the-finney-attack-more-difficult). 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
CC BY-SA 3.0
2012-08-17T01:21:15.357Z
2012-08-17T01:21:15.357Z
Highly Irregular
<p>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.</p>

CC BY-SA 3.0
2018-02-16T14:27:27.540Z
2018-02-22T00:14:22.503Z
2018-02-22T00:14:22.503Z
Gmae
<p>This is oversimplified, but here's one sequence showing a serie of payment transactions:</p>

<p>Miner --> You -->  Me -->  SatoshiDice --> Me</p>

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

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

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

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

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

<p>Here's an example of the transactions for a losing 0.02041833 BTC bet:</p>

<ul>
<li><p><a href="http://satoshidice.com/lookup.php?tx=0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e" rel="nofollow">http://satoshidice.com/lookup.php?tx=0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e</a></p></li>
<li><p><a href="http://blockchain.info/tx-index/16106266/0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e" rel="nofollow">http://blockchain.info/tx-index/16106266/0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e</a></p></li>
<li><p><a href="http://blockchain.info/tx-index/16106269/e69d7d733d4de5eee6fae0d402fe0db0fdd2544e9ece0f169922d143a8eaf850" rel="nofollow">http://blockchain.info/tx-index/16106269/e69d7d733d4de5eee6fae0d402fe0db0fdd2544e9ece0f169922d143a8eaf850</a></p></li>
</ul>

<p>You can see the flow visually here:</p>

<ul>
<li><a href="http://blockchain.info/tree/16104343" rel="nofollow">http://blockchain.info/tree/16104343</a>  (click on the orange dot for the 0.01569037 BTC payment, which was one of the two inputs that paid for the bet.)</li>
</ul>

CC BY-SA 3.0
2013-12-13T18:09:42.550Z
Can I send coins the same way as SathoshiDice does using the standard client?
Petr Peller
CC BY-SA 3.0
2012-08-17T01:13:05.150Z
Wouldn't it be better to use a transaction of a winning bet as an example?
Highly Irregular
CC BY-SA 3.0
2012-08-19T16:24:28.593Z
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
CC BY-SA 3.0
2012-08-16T20:58:18.647Z
2012-08-16T21:09:58.887Z
2012-08-16T21:09:58.887Z
Stephen Gornick
<p>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?</p>

CC BY-SA 3.0
2013-02-04T18:50:44.630Z
@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
CC BY-SA 3.0
2012-08-16T20:46:11.573Z
They are not running the standard bitcoind.
Stephen Gornick
CC BY-SA 3.0
2012-08-18T11:59:55.743Z
How do you know?
Shamoon
CC BY-SA 3.0
2012-08-18T17:34:49.540Z
SatoshiDice uses bitcoinj to create its transactions.
jim618
CC BY-SA 3.0
2012-08-19T00:51:27.240Z
Does bitcoinj offer anything that bitcoind doesn't?
Shamoon
CC BY-SA 3.0
2012-08-19T08:48:13.057Z
@Shamoon of course it does, why would they be using it otherwise?
o0'.
CC BY-SA 3.0
2012-08-19T11:09:22.227Z
@lohoris can you clarify as to what it offers that's different?
Shamoon
CC BY-SA 3.0
2012-08-19T17:11:15.777Z
@Shamoon no, I have no idea. It is just obvious it does.
o0'.
<bitcoind><confirmations><satoshidice>
How does SatoshiDice operate with 0 confirmations?
Shamoon
# How does SatoshiDice operate with 0 confirmations?

(Asked by: username_0 on 2012-08-16)

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?

**Tags:** bitcoind, confirmations, satoshidice

> **Comments:**
> **username_2**: They are not running the standard bitcoind.  
> **username_0**: How do you know?  
> **username_3**: SatoshiDice uses bitcoinj to create its transactions.  
> **username_0**: Does bitcoinj offer anything that bitcoind doesn't?  
> **username_4**: @username_0 of course it does, why would they be using it otherwise?  
> **username_0**: @lohoris can you clarify as to what it offers that's different?  
> **username_4**: @username_0 no, I have no idea. It is just obvious it does.  
> **username_1**: @Lohoris its not actually obvious. you are making an assumption. would be nice if when you make assumptions that you would attempt to explain  

---

## 3 answers

### Answer by username_2 on 2012-08-16. Score: 4 | Accepted answer

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:

* <http://satoshidice.com/lookup.php?tx=0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e>
* <http://blockchain.info/tx-index/16106266/0419fdcbc82add4b46b6fe11e362561d0a3d18329770b36a637a2b60a881cf1e>
* <http://blockchain.info/tx-index/16106269/e69d7d733d4de5eee6fae0d402fe0db0fdd2544e9ece0f169922d143a8eaf850>

You can see the flow visually here:

* <http://blockchain.info/tree/16104343> (click on the orange dot for the 0.01569037 BTC payment, which was one of the two inputs that paid for the bet.)

> **Comments:**
> **username_5**: Wouldn't it be better to use a transaction of a winning bet as an example?  
> **username_2**: 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.  
> **username_8**: Can I send coins the same way as SathoshiDice does using the standard client?  

---

### Answer by username_5 on 2012-08-17. Score: 4

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).

> **Comments:**
> **username_6**: They could still do it without cutting SatoshiDice off by using a [Finney attack](http://bitcoin.stackexchange.com/questions/1192/would-a-reduced-block-generation-time-make-the-finney-attack-more-difficult). 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.  

---

### Answer by username_7 on 2018-02-16. Score: 0

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.


---

