Kryptogamers 100% Tamper Proof Blockchain Powered Provably Fair Card Shuffling Algorithm Explained

in #steem5 years ago (edited)

Hope you all are having a great time playing blackjack. This post was due a long time as we were a bit busy adding new games, reward systems and tokens. Finally, we are here after 2 months of rigorous testing of our triple factor tamper-proof blockchain powered card shuffling RNG algorithm. We want each one of you to understand exactly how this works so that you can enjoy our games completely without worrying about fairness and security.

kryptogamers.com

Tamper-Proof Triple Factor RNG Algorithm

We use the same algorithm for generating cards in blackjack as well as for generating numbers in dice. So we will try to make it as easy as possible for you to understand it in detail.

Blackjack
  • When you click on Verify button next to any blackjack bet, you see a sequence such as 4,12,9,34,27,… printed in the last row. These are the cards dealt to the player as well as the dealer one by one starting with the player. Here’s how that sequence is generated.

  • Each game has a new sequence of cards generated out of exactly 4 decks.

  • Every particular sequence of cards is generated by 3 major parameters:
    o Client Seed : Generated by the player
    o Server Seed : Generated by the server
    o Steemit Transaction ID : Generated by the Steem Blockchain

  • Due to a combination of these 3 parameters, it is impossible for anybody to know the sequence or to manipulate the card sequence in any manner.

  • The above 3 parameters is fed into the SHA-512 cryptographic hash algorithm to generate the HMAC hash using the below line of code:

crypto.createHmac('SHA512',client_seed + trx_id.substring(0,10)).update(server_seed).digest('hex');
  • The Resulting Hash of length 128 characters generated in hexadecimal looks similar to this:
    ‘3c658c63b1735bc30c622f909488c0e4d00d69d8370064abaf1cf6c96a2aa201dc4d6fb10a5ccd8394bccc6e2e0c11e676a9fd99e50ef000a1db4eefd59a0f71’

  • Each character in this 128 character long hash is of 128 bits

  • So we split the hash into group of 2 characters each (256 bits) and convert each group into an integer which can take any value between 0 and 255 (256 possibilities)
    Eg: ‘3c’ => 60, ‘65’ => 101, ‘8c’ => 140, ‘63’ => 99,............. ‘71’ => 113

  • Now we have a sequence of 64 integers each of whose values ranges from 0 to 255: [60,101,140,99,……….113]

  • A deck has 52 cards => 4 decks = 208 cards => Integer values should be between 1 to 208.

  • So we discard all integers whose value is greater than or equal to 208.

  • Then we divide each integer with 52 and keep the remainders => [8,49,36,47,………9]

  • This is the final sequence printed in the last row of the verify button after all the calculations.

  • Add 1 to each one of them => [9,50,37,48,……..10]

  • Now each integer can be any card from 1 to 52 in the order spades, hearts, clubs and diamonds such that 1-10 corresponds to cards 1 through 10 and 11, 12, 13 corresponds to jack, queen and king.


Dice
  • Each rolled number is generated by the same 3 parameters:
    o Client Seed : Generated by the player
    o Server Seed : Generated by the server
    o Steemit Transaction ID : Generated by the Steem Blockchain
  • The above 3 parameters is fed into the SHA-256 cryptographic hash algorithm to generate the HMAC hash using the below line of code:
crypto.createHmac('SHA256',client_seed + trx_id.substring(0,10)).update(server_seed).digest('hex');
  • The resulting hash of length 64 characters looks similar to this:
    ‘3660b115dacc385fd13ae21ff3cd904aab05faa642c3adb009467fe2801eae25’
  • It is then converted to integer and divided by 100 to get a number between 0 and 99.
  • Then 1 is added to the remainder to get an integer between 1 and 100 to get the final rolled number.


How to Verify Any Past Transaction



Due to the immutability of blockchain and thus of the steemit transaction-id which is used as a salt in the algorithm, it is impossible to tamper with the results at any point in the past or the future. So, any past transaction can be verified using the transaction id in the Verify Button in the Provably Fair Section of the Website. Recent transactions can be verified only after 3 minutes as each server seed is only exposed after 3 minutes.

kryptogamers.com

If you still have any questions, contact us on discord anytime and we will be happy to help you out.

Stay Happy! Stay Motivated!

Sort:  

Congratulations @kryptogames! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made your First Vote

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

3 years on Steem - The distribution of commemorative badges has begun!
Happy Birthday! The Steem blockchain is running for 3 years.
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Thanks for clearing this all out!
I can recommend playing on kryptogamers! Really enjoy the blackjack!