Was Your Blackjack Hand Provably Fair?

    February 26, 2015 | Casino Play Nitrogen Blackjack

    We’ve always taken a lot of pride in being the most trusted bitcoin sportsbook. As we start to add games to the Nitrogen Casino, we want to ensure you continue to trust that your bitcoin is safe with us. When you have a bit of bad luck, we never want you to wonder whether our casino is actually fair.

    In the real world, knowing that a shuffle is random is easy – you cut the deck! Having “Provably Fair” software allows us to offer you the same opportunity online.

    We link to external verification in the “Provably Fair” button that you see in Nitrogen Blackjack in our bitcoin casino platform. If you’d like to take a deeper look, you can actually view the source of that External Verification page to see all of our code.

    Looking for another way? We’ve included below the steps you need to take to verify your outcome using completely external sources. By external, I mean that none of the code or tools you’ll use to verify our software have been created by anyone affiliated with Nitrogen Sports.
     

    Provably Fair Blackjack

     
    Well, I just lost with a 16! We’ll use the details of that hand as an example throughout these steps. At any point, click on the images to view them full screen. When you’re selecting the values for the Initial Shuffle, Deck Hash etc, double click on the field to select the entire string.

    Step 1: After playing your hand, go to http://www.movable-type.co.uk/scripts/sha256.html, and copy and paste the Server Seed followed by the Initial Shuffle (there should be no spaces in between them) in the Message box. Click the “Generate Hash” button. You should see that the hash generated on that website matches the Deck Hash you see on Nitrogen.

    Why you can trust this: We have no affiliation with Movable Type. They provide an independent interface for generating hashes based on the SHA256 algorithm.

    Before the hand starts, you can see your Deck Hash for the next hand. This means that there’s no way we could use your client seed to manipulate the Initial Shuffle in our favor.
     
    Movable Type Scripts

     

    Step 2: Go to http://jsconsole.com/; this is a javascript console. Copy and paste all of the code from the following sources into the console (don’t forget to press enter after you insert the code from each source):

    This code is the Mersenne Twister random number generator (RNG) algorithm. The second piece of code is the SHA256 algorithm.

    Why you can trust this: We have no affiliation with Github, the Github user banksean, or the Google crypt-js team.

    Step 3:

    Copy and paste the following code into the console, and press enter when you’re done.

     

    function shuffleFisherYates(elements, randomNumber) {
    if (!elements || !elements instanceof Array) {
    throw new Error(“‘elements’ object must be a valid Array.”);
    }

    randomNumber = randomNumber || Math.random();

    var mt = new MersenneTwister(randomNumber);

    for (var i = elements.length – 1; i > 0; i–) {

    var j = mt.genrand_int32() % (i+1);

    var temp = elements[i];

    elements[i] = elements[j];

    elements[j] = temp;

    }

    }

     

    Why you can trust this: This is the standard Fisher-Yates shuffling algorithm. We use both the Mersenne Twister and Fisher-Yates when shuffling.

    Step 4: Create three variables in the jsconsole that are equal to the Client Seed, Server Seed, and Initial Shuffle of your Blackjack hand. Make sure you don’t add any extra spaces! Press enter when you’re done. Here’s the code to help you do that; copy and paste the following code, and insert the specific variables from your hand:

    var clientSeed = ‘enter client seed here’;
    var serverSeed = ‘enter server seed here’;
    var initialShuffle = ‘enter initial shuffle here’;

    Here’s what that looks like for me when I press enter:

    JavaScript Console Variables

    Why you can trust this: All this step is doing is telling the console what the specifics of your hand were.

    Step 5: Copy the following code into the jsconsole to reshuffle the deck.

    var seed = CryptoJS.SHA256( clientSeed.toString() + serverSeed.toString() ).toString();
    seed = parseInt(seed.substring(seed.length – 8), 16);
    var mt = new MersenneTwister(seed);
    var randomNumber = mt.genrand_int32();
    var cards = initialShuffle.split(‘,’);
    shuffleFisherYates(cards, randomNumber);
    cards = cards.join(‘,’);
    console.log( ‘Final Shuffle:’ );
    console.log( cards );

    This is the code that actually takes your initial shuffle and reshuffles it based on the Mersenne Twister RNG and the Fisher-Yates shuffling algorithm. Now press enter.

    The jsconsole will give you a value that should be identical to our Final Shuffle value. Depending on your screen size, you may have to scroll down a bit to see the values. Here’s mine:

    Final Shuffle Value

    Congratulations; you’ve just proved that your hand was fair! If you have any other questions about our software, please don’t hesitate to submit a Support Ticket on Nitrogen Sports. Our support team would be happy to help.

    If you want a quick refresher on playing casino online, check the guides published on Nitrogen Sports Blog. We post tips, strategies, and rules of playing different casino games.
     

    Related Articles