Provably Fair Poker

Provably Fair Poker is a form of online poker that relieves the player from the need to trust the server organizing the game or increases the level of trust, allowing the players to make sure that the game results were fair. The principle of its operation is based on the set of cryptographic techniques called Mental Poker. The Provably Fair system can be used in all poker variants on different betting structures.

History
The first mentions of Mental Poker appeared in the late 70s in the work of researchers at the Massachusetts Institute of Technology. In this technical memo, the authors described the possibility of a fair game of poker between two players using cryptographic techniques. The concept of multiplayer Mental Poker was proposed in 1984 in Moti Yung's book "Cryptoprotocols". Theoretical studies have continued and during this time several ways have been proposed on how to use Mental Poker in practice. For a long time, it was not possible to implement the proposed principles. Computers simply could not process the necessary requests fast enough and the batch, in this case, could take dozens of hours. But in our time, the problem of computer performance is no longer so acute. Therefore, the emergence of online poker using the principles of Mental Poker was only a matter of time.

It is not known for certain who first created such poker, but there is reason to believe that it was Patrick Bay. He created the CypherPoker project in 2015, which worked using the protocol of shuffling cards with commutative encryption. CypherPoker is different from the usual online poker. This is a program written in JavaScript and requires a long step-by-step installation. Although the program was not user-friendly, it fulfilled its functions and gave users the experience of Provably Fair game.

Another project that has applied the principles of Mental Poker is Fair Poker. Launched in 2021, the site allowed users to simply sign up and play without requiring any setups.

Since then, the idea of Mental Poker has not been widely adopted. At the moment, there are only a few projects using the Provably Fair system.

Decentralized Card Shuffling with commutative cards encryption
This is one of the algorithms that does not require trust in a third party. This principle uses commutative encryption, in which the decryption order does not matter. The algorithm of actions in poker using this system will be as follows:


 * 1) One of the players or the server of the poker site generates the deck.
 * 2) Alice (player 1) receives a deck, shuffles it, and encrypts each card with her unique key A.
 * 3) Bob (player 2) receives a deck encrypted and shuffled by Alice. Bob doesn't know where which card is. He shuffles the deck again and encrypts each card with his unique key B.
 * 4) Alice gets the double-encrypted deck back from Bob. Alice decrypts each card with the previously used key A. Since Bob's encryption hasn't gone anywhere, Alice doesn't know where which card is. Alice now encrypts cards using a different unique key for each (A1, A2, …, A52).
 * 5) Bob gets the deck back from Alice and decrypts the cards using his key B. Alice's cipher is still valid, so Bob cannot see the order of the cards. Bob encrypts each card with an individual key (B1, B2, …, B52).
 * 6) The deck is ready, the game begins.
 * 7) Alice gets indexes of two face-down cards.
 * 8) Alice tells Bob the indexes of her cards and receives the corresponding decryption keys from him. Using her keys and the keys she received from Bob, Alice decrypts her cards. Thus, no one but her can see them.
 * 9) Bob goes through the same procedure.
 * 10) The flop is laid out.
 * 11) Alice and Bob see which indexes have the cards laid out and send the corresponding keys.
 * 12) Alice and Bob decrypt the flop. And repeat the same for the river and manner.

The number of players can vary, but the more there are, the longer the encryption process will take, and therefore the game itself.

This principle is used by the CypherPoker and Fair Poker projects.

Verification of RNG operation
This principle of Provably Fair Poker does not completely exclude trust in a third-party server. But a third-party server uses the values transmitted by the players in the final result and at the end of the game gives them the opportunity to verify the result to make sure it was fair. The algorithm of actions in such games is as follows:


 * 1) The poker site server generates and shuffles the deck.
 * 2) Alice and Bob send special values (seeds) to the poker site server.
 * 3) The poker site server uses the values from Alice and Bob to shuffle the deck again. Thus, Alice and Bob participate in the formation of the deck.
 * 4) The deck is now complete. Alice and Bob receive a hash of the deck, for which they will receive a key after the end of the game.
 * 5) After the end of the game, Alice and Bob receive a key with which they can decrypt the previously obtained hashed deck and make sure that the order of the cards in the deck coincides during the game with the value previously received from the server.

This principle is used in many casino table poker games and in the Coinpoker project.

External Sources:

 * 1) https://fair.poker/
 * 2) https://bitcointalk.org/index.php?topic=5145957.0
 * 3) https://www.bitcasinorank.com/provably-fair-poker/
 * 4) https://en.wikipedia.org/wiki/Mental_poker
 * 5) http://www.torontocitylife.com/2015/09/19/totally-mental-poker/
 * 6) https://github.com/monicanagent/cypherpoker.js/