Doesn't the block hash or the transaction id provide enough entropy (for example, by using block_hash % 37 to generate a random number between 0 and 36)?

Block Chain Roulette determines the lucky number as a function of the hash of newest block in the chain:

Everytime a new block is created on the Bitcoin block chain, the roulette wheel is spun and a random number between 0 and 36 is generated... random hash = hmac_sha512(secret hash, block hash) ... the random decimal integer is then multiplied by 37 and divided by (72057594037927935 + 1), decimal places dropped, resulting in a number between 0 and 36. 14 hex charecters are used because this represents a maximum random number of 72057594037927935, a number which is divisable equally by 37 (Or at least very very close to being equally divisable, when working with such large numbers). This ensures each number between 0 and 36 has an equal probability of being chosen. Continue reading...

SatoshiDice determines win/lose by using a pre-determined secret as well:

The lucky number used to determine the winner of games is simple. It is simply the first bytes of hmac_sha512(secert,txid:out_idx). That would be the secret string as the key and the transaction ID of your bet transaction as the data.

Can someone generate a transaction in such a way that its hash is known ahead of time?
Edit: It seems like the second part of the question has already been answered.

1 Answer 1


Obviously many gambling websites cheat. Most of them are not transparent.

An important thing is that most gambling websites that use a government-backed currency are subject to gambling laws in the country of that government.

Bitcoin isn't. Bitcoin is currently not subject to any gambling law and so it would be easier for gambling site owners to be unfair. For this reason, it can be very important for a Bitcoin business to be transparent if they want to gain traction in the masses.

Another reason, Bitcoin offers a unique way to prove fairness of such applications from within it's own workings. Why wouldn't you use it if you plan to offer a fair service after all??

  • Also, they have a "secret value/hash" so that you can't predict beforehand what the outcomes will be. They often will post the hashes of the secret values so you can verify that they didn't change the secret values and the actual secret values a few weeks later.
    – lurf jurv
    Apr 1, 2013 at 20:50

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