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

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.

share|improve this question

2 Answers

up vote 8 down vote accepted

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

For a transaction to be it must be the only that claims the outputs (no double spend) and the transaction that created the claimed outputs is 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 Satishi Dice is not tricked into sending coins back without receiving the wager.

share|improve this answer
1  
Very clever. Thanks for explaining! I guess I could use the "createrawtransaction" command to build these kind of transactions, correct? – Max Min Jan 24 at 9:56

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.

share|improve this answer

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.