I am trying to understand how does a satoshidice draw work.

As far as i have understood satoshidice generates daily two public hashes:

  • HMAC hash (H from here on)
  • Position hash (P grom here on)

You can check here all the H and Ps until 31.10.2014. As you can see they include hash for the next two weeks too?why?

Getting an example of a H they provide (b8dd879f66b36f0b0705c00eb56d91a82c927f6c5d25b0d470d4f17615702bed) i can see they are 64bytes Hexadecimal long so that's a SHA256 Hash.

But how do they calculate this hashes? I mean they are the product of using a SHA256 hash calculation, without secret key (HMAC)? And the next day they release the original data that originated H and P, so that people can check what? I don't understand it very well..

If the resulting string used in the draw is calculated as:

Resulting String = hmac_sha512(daily_secret, "tx_id:out_index")

I suppose daily secret is our H. What's "tx_id:out_index"? Trasaction id concatenated by index?

How could i verify my draw was totally fair with all these hashes? This is a mess..

They say:

"That is, the daily 'HMAC' Secret String is used as the key to an HMAC_SHA512(key, message) function. The message portion of this function is a string formed from the transaction ID, a colon, and the output index number of the bet payment within the transaction. In order to calculate the lucky number, 4 Hexadecimal Digits are being chosen from the above HMAC Output. The position of these 4 Digits, is being taken from the First bytes of the 'Positions' Secret Key. Finally,having the output of the HMAC Function,and the daily Positions,we have the Lucky Number as an unsigned Integer in the range 0-65535."

If i now H and P ahead of time, if could get "tx_id:out_index" too wouldn't i be able to predict the drawing result?


Browse other questions tagged or ask your own question.