<p>A transaction simply link an older output transaction and reasign it. You can send bitcoin you just reveice because you can link to the other transaction immediately. Then the transactions can be mined in the same block. The standard bitoin client doesn't let you spend unconfirmed bitcoin because it could let some create an attack.</p>

CC BY-SA 3.0
2013-01-20T17:25:02.383Z
2013-01-20T17:25:02.383Z
Gopoi
<p>simply put its like a paradox if i send 100 Satoshi to the site and only have 99 in my wallet the transaction fails i will have spent no Satoshis they will have received none trying to send Satoshi that does not exist would invalidate the second transaction </p>

<p>so unlike money you can not do the following walk into a store take a dollar item and leave 90 cents on the counter walk out and then try to return that item later on for store credit the act of saying i have a dollar when i only have 90 cents will invalidate the entire transaction i will have given zero then sending me some of the bitcoins i never really sent everytime a bit coin is sent the new owner becomes part of that bitcoin their address gets imprinted on it so if SatoshiDice never got your bitcoin officially then they can not send it back you as that would be a bitcoin that does not exist in a sense this is why the debate over resseting the blockchain to reduce the storage broaden is a big issue well it could be done another story for another day in short that would make a bitcoin bank Holiday of sorts  likely a few hours as the network would have to shutdown as in stop accepting payments then verify all payments accepted then reduce each bitcoin to a base hash minis all of its history and then have the wallets shorten this down using a standardized algorithm  for those who do not spend most of what they have no problem a typical computer would straiten out a typical wallet in less then 5 min an older smartphone might take a day even an iphone might take a half an hour for the most part most people would be ready for bussines before the block chain was back up the wait would be the transactions to be verified by the miners as a non static network could never get back into sync off topic but bottom line is SatoshiDice is secure due to the nature of how the transactions are verified if a block chain reset were to take place say once a month then SatoshiDice would likely cancel all betting for that day and resoume an hour after the network was confirmed to be up and running then you still have the trust of a central server for all past transactions i would like to see a torrent like system to split up the block chain for faster access and secure storage </p>

CC BY-SA 3.0
2014-01-04T15:37:25.360Z
2014-01-04T15:37:25.360Z
user11767
<p>A transaction claims some outputs from previous transactions and then creates new outputs whose summed value is equal to (or less than, in the case of fees) the sum of the claimed outputs values.</p>

<p>For a transaction to be valid it must be the only one that claims the outputs (no double spend) and the transaction that created the claimed outputs must be valid. Satoshi Dice can immediately send back a transaction containing the winnings because the transaction claims the output of the incoming transaction, chaining the two transactions together.</p>

<p>The result is that either both transactions are valid, in which case the player gets his winnings, or the first transaction is not valid, immediately invalidating the second one, and Satoshi Dice is not tricked into sending coins back without receiving the wager.</p>

CC BY-SA 3.0
2013-01-24T09:56:12.567Z
Very clever. Thanks for explaining! I guess I could use the "createrawtransaction" command to build these kind of transactions, correct?
Max Min
CC BY-SA 3.0
2013-08-05T19:17:20.467Z
No one seems to have answered your question of how to create such tx. I am guessing that `createrawtransaction` should do it. I myself have used bitcoinj and bccapi to create such transactions but not tried with bitcoind. Also, blockchain.info lets you [broadcast](https://blockchain.info/pushtx) such raw transactions without running your own client. [Unowallet](https://unowallet.cfapps.io) is a wallet that lets you spend coins with zero confirmations.
Jus12
CC BY-SA 3.0
2013-01-22T11:40:52.127Z
2013-09-13T21:03:42.150Z
2013-09-13T21:03:42.150Z
cdecker
<p>The popular bitcoin betting game Satoshi Dice sends back payments very fast, they don't wait for confirmations. The user sends money to Satoshi Dice and gets back winnings a couple of seconds later. Here's a quote from their site: </p>

<blockquote>
  <p>The SatoshiDice Bitcoin game operates with zero confirmations [...] 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.</p>
</blockquote>

<p>I think I understand the theory behind this: Satoshi Dice always sends back coins from your own bet. So if your bet doesn't get confirmed then your winnings also won't get confirmed.</p>

<p>What I don't understand is how I could technically create these kind of transactions. Using bitcoind, how could one build these transactions?</p>

<p>Thanks for your suggestions.</p>

<bitcoind><zero-confirmation>
How does Satoshi Dice's 'zero confirmations' transaction system work technically?
Max Min
# How does Satoshi Dice's 'zero confirmations' transaction system work technically?

(Asked by: username_0 on 2013-01-20)

The popular bitcoin betting game Satoshi Dice sends back payments very fast, they don't wait for confirmations. The user sends money to Satoshi Dice and gets back winnings a couple of seconds later. Here's a quote from their site:

> The SatoshiDice Bitcoin game operates with zero confirmations [...] 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.

I think I understand the theory behind this: Satoshi Dice always sends back coins from your own bet. So if your bet doesn't get confirmed then your winnings also won't get confirmed.

What I don't understand is how I could technically create these kind of transactions. Using bitcoind, how could one build these transactions?

Thanks for your suggestions.

**Tags:** bitcoind, zero-confirmation


---

## 3 answers

### Answer by username_3 on 2013-01-22. Score: 14 | Accepted answer

A transaction claims some outputs from previous transactions and then creates new outputs whose summed value is equal to (or less than, in the case of fees) the sum of the claimed outputs values.

For a transaction to be valid it must be the only one that claims the outputs (no double spend) and the transaction that created the claimed outputs must be valid. Satoshi Dice can immediately send back a transaction containing the winnings because the transaction claims the output of the incoming transaction, chaining the two transactions together.

The result is that either both transactions are valid, in which case the player gets his winnings, or the first transaction is not valid, immediately invalidating the second one, and Satoshi Dice is not tricked into sending coins back without receiving the wager.

> **Comments:**
> **username_0**: Very clever. Thanks for explaining! I guess I could use the "createrawtransaction" command to build these kind of transactions, correct?  
> **username_4**: No one seems to have answered your question of how to create such tx. I am guessing that `createrawtransaction` should do it. I myself have used bitcoinj and bccapi to create such transactions but not tried with bitcoind. Also, blockchain.info lets you [broadcast](https://blockchain.info/pushtx) such raw transactions without running your own client. [Unowallet](https://unowallet.cfapps.io) is a wallet that lets you spend coins with zero confirmations.  

---

### Answer by username_1 on 2013-01-20. Score: 2

A transaction simply link an older output transaction and reasign it. You can send bitcoin you just reveice because you can link to the other transaction immediately. Then the transactions can be mined in the same block. The standard bitoin client doesn't let you spend unconfirmed bitcoin because it could let some create an attack.


---

### Answer by username_2 on 2014-01-04. Score: -1

simply put its like a paradox if i send 100 Satoshi to the site and only have 99 in my wallet the transaction fails i will have spent no Satoshis they will have received none trying to send Satoshi that does not exist would invalidate the second transaction

so unlike money you can not do the following walk into a store take a dollar item and leave 90 cents on the counter walk out and then try to return that item later on for store credit the act of saying i have a dollar when i only have 90 cents will invalidate the entire transaction i will have given zero then sending me some of the bitcoins i never really sent everytime a bit coin is sent the new owner becomes part of that bitcoin their address gets imprinted on it so if SatoshiDice never got your bitcoin officially then they can not send it back you as that would be a bitcoin that does not exist in a sense this is why the debate over resseting the blockchain to reduce the storage broaden is a big issue well it could be done another story for another day in short that would make a bitcoin bank Holiday of sorts likely a few hours as the network would have to shutdown as in stop accepting payments then verify all payments accepted then reduce each bitcoin to a base hash minis all of its history and then have the wallets shorten this down using a standardized algorithm for those who do not spend most of what they have no problem a typical computer would straiten out a typical wallet in less then 5 min an older smartphone might take a day even an iphone might take a half an hour for the most part most people would be ready for bussines before the block chain was back up the wait would be the transactions to be verified by the miners as a non static network could never get back into sync off topic but bottom line is SatoshiDice is secure due to the nature of how the transactions are verified if a block chain reset were to take place say once a month then SatoshiDice would likely cancel all betting for that day and resoume an hour after the network was confirmed to be up and running then you still have the trust of a central server for all past transactions i would like to see a torrent like system to split up the block chain for faster access and secure storage


---

