Okay, so after waiting for a day and half and getting no reply from SatoshiDice staff about the script, I decided to go forward and figure out myself how SatoshiDice provably fair system works. As directed by @sukbir in couple of posts above, the admin of SatoshiDice posted current provably fair script here:
https://bitcointalk.org/index.php?topic=77870.msg30976380#msg30976380. But the post was unclear about lots of things, also js links weren't working so I had to figure out some things like Mersenne Twister algorithm, how return value of Mersenne Twister algorithm is handled, how 4-byte number is determined, etc. I figured out everything and finally found how SatoshiDice calculate dice rolls.
I have created my own verification tool for SatoshiDice (the first ever) and uploaded it on the below link
Explanation about how it works (so you can verify it on your own without using the verifier):
Before moving further let me state the important thing -
SatoshiDice's Provably Fair System is completely fair and the doubts about the script that I expressed earlier in this thread were found wrong.Now coming to the system's explanation, first thing a user needs to make sure is that server seed hash actually belongs to the exposed server seed (server seed plain text). To do so, go to this tool:
https://emn178.github.io/online-tools/sha256.html. Paste 'server seed plain text' in the input column, change 'input type' to Hex from Text and check if the Output matches the Server Seed Hash provided by SatoshiDice.
Next step is to verify whether Random Number Seed is correct or not. The process of finding random number seed is as follows:
Random Number Seed = SHA256 Hash of Server Seed + Transaction Id + Vout
Consider this bet:
https://satoshidice.com/fair/?id=2509476In the above bet,
Server Seed = 1689f63f6470e19105c131a0b5cde0d475129bf026b7e6a3ecf3571aa1481c15
Transaction Id = 254f030a3ae3691e90c09de297eae6d34d3485fdfc3acf47da04c9c82bb4fc62
Vout* = 39
*In case you wonder what vout is, vout refers to the index of output in the transaction. A transaction can have more than one ouput. The vout of first output is 0, then 1, then 2 and so on. Vout 39 means we are talking about 40th output of the transaction.
The next step is convert Vout from decimal to hexidecimal. Use this tool:
https://www.rapidtables.com/convert/number/decimal-to-hex.html. The hexidecimal equivalent of 39 is '27'. The length of vout should be 8 so we will add preceding zeros to make it of this length.
So, Vout = 00000027
So random number seed = SHA256 (1689f63f6470e19105c131a0b5cde0d475129bf026b7e6a3ecf3571aa1481c15254f030a3ae3691
e90c09de297eae6d34d3485fdfc3acf47da04c9c82bb4fc6200000027)
To calculate SHA256 hash of this string, go to this tool again:
https://emn178.github.io/online-tools/sha256.html. Paste the above string in the input column, change the input type to Hex and check if the output matches the Random Number Seed shown on Bet ID page.
The final step is to calculate Mersenne Twister to get the probability distributed between 0 and 1. Then multiply the number with 65536 to get the dice roll result. I didn't find any tool online to find Mersenne Twister number the way SatoshiDice uses so I created my own. Use this tool:
https://webtricks.website/satoshidice, fill all columns and you will be shown the number.
In case of above bet, it will be 0.9642251755576581 which when multiplied by 65536 gives 63191.461104 as the result. Remove the decimal part and the rest is your dice roll which will match the dice roll shown to you on the website, making SatoshDice 100% provably fair!