* New! Latest stable version of OK wallet v7-SpaceMonkey *

OKBets.io Released! - Provably Fair Explanation Thread

Started by OKBets, June 22, 2017, 04:27:35 PM

Previous topic - Next topic


Dear users, today I will be explaining how the provably fair system of https://okbets.io works!

Before you start betting, be sure to write down the "Current Hash" on the provably fair tab in Dice

Then select a nice client seed in the same tab and start betting, for this example I have chosen the seed "Magic_Seed" and my hashed server seed was "c9b6b0d570839994968fda2af918f010e08c1d56e0cad0c3f454ed91e0c95bda" but anything would do!

Then place your bets and you will see your actual client seed.

As you can see it ends with "-" and then a number, this number increases every bet you make!

Once you are done with betting, hit the "Change Server Seed" button in the provably fair tab and write down the "Previous Server Seed"

With this previous server seed you are able to generate the "Current Hash" you had written down earlier and ofcourse the outcomes to the bets. In our example I have recieved "1973597b53d1037aecb86221fae8fa174b0a0ce53a8ced27b2deb56069ee6dfb" as the server seed.

To generate the hash previously written down, all you have to do is creating the SHA256 hash of the server seed which you just recieved, you can use an online tool to do this, https://www.freeformatter.com/sha256-generator.html#ad-output is one that works!
If everything went correctly then the hash you get from the tool should be the same as the hash you've recieved beforehand, if you do this with the example values you'll see that it was indeed the same and thus https://okbets.io couldn't have cheated you on that!

Next we will have to create the actual outcomes of the bets!
To do this we will have to generate a SHA512 HMAC, you can use https://www.freeformatter.com/hmac-generator.html#ad-output for this!
In the "Copy-paste the string here" box you will have to put your client seed, in my example this is "Magic_Seed-5"
in the "Secret Key" box you will have to put the server seed in, in this example it's "1973597b53d1037aecb86221fae8fa174b0a0ce53a8ced27b2deb56069ee6dfb"

You will then recieve a hexadecimal string, in this example it is "22fea2cb4d9f7f9d34ebf7aad522062a9d4f7203c5f72f335299a79b0d67ecb60a874afab0856dfe23cc18e79940b0860daf9f4d7ebd77663e6f37e04fcc870d"

From this string we take the first 8 characters, in our case "22fea2cb"
We convert this from hexadecimal to a decimal number, in our case this is "587113163"
Then we have to divide this by 4294967296 (or 2^32), and this results in "0,13669793563894927501678466796875", and as shown in a previous screenshot, the actual outcome for this bet was "13.67" so it was indeed correct!

You can continue these steps for all your bets made with the server seed and prove that OKBets.io is indeed fair!

For the Jackpot things are done a little bit differently, here a random number between 0 and 1 is chosen and used as the % that wins, so lets say its 0.5 and we have 3 betters who all bet 1 OK, #1 #2 and #3
first 33.33% goes to #1
second 33.33% goes to #2
third 33.33% goes to #3
The number is 50%
which goes through #1 and lands in #2, making #2 win the pot.

This is provably fair due to the hash being given infront and the outcome + secret after the game.
With the outcome and the secret you can calculate the hash given beforehand by going to this site http://rextester.com/l/nodejs_online_compiler and executing the following code
var outcome = "outcome"
var secret = "secret"

const crypto = require('crypto');

crypto.pbkdf2(outcome, secret, 10000, 64, 'sha512', function(err, derivedKey) {

You will have to change "outcome" to the outcome (the number) and "secret" to the secret (second box) but you need to keep the "" in it