Post
Topic
Board Gambling
Merits 2 from 1 user
Re: BETCOIN.AG- DICE IS BACK!- #1 Casino, Sportsbook est. 2013- BTC,ETH,XRP,LTC,XMR
by
DarkStar_
on 04/07/2020, 19:18:53 UTC
⭐ Merited by TwitchySeal (2)
Since they seem to use a unique approach to provably fair (it would have been much nicer if they just copied the standard nonce based method instead of trying to reinvent the wheel), I wrote a open source, and truly independent verifier that players can use if they want using purely client side JS. Here's an example of a verified bet.

Nice work.   How did you figure out that this is what they're doing to HMac256(server, client)?  Just curious since I tried and failed.

Code:
let hash = CryptoJS.HmacSHA256(serverSeed, clientSeed).toString();
    let PRNGSeed = parseInt(`0x${hash.substr(hash.length - 8)}`);
    mt.srand(PRNGSeed);
    document.getElementById("resultBox").className = "card mt-3 bg-success"
    document.getElementById("resultText").innerHTML = `Roll: ${mt.rand(0, 10000)}`;

(Not familiar with the JSMTRand package)

From the gamebetr/provable repository, we can find their PHP implementation to set the PRNG seed:
Code:
private function generateSeedInteger(): int
{
    return hexdec(substr(hash_hmac('sha256', $this->getServerSeed(), $this->getClientSeed()), -8, 8));
}

Then they just use PHP's built in mt_rand method to get the random number. JSMTRand was a package I found that specifically mentioned having the same Mersenne Twister implementation as PHP, so it would generate the same random numbers given the same seed.