22

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.

3 Answers 3

14

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.

2
  • 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, 2013 at 9:56
  • 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 such raw transactions without running your own client. Unowallet is a wallet that lets you spend coins with zero confirmations.
    – Jus12
    Aug 5, 2013 at 19:17
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.

-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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.