Playing mental poker is a difficult problem for a number of reasons. The foremost reason is that it is impossible, a result due to Shamir, Rivest and Adleman.
G.R. Blakley and D. Chaum
During Lift16, Ethereum / Consensys presented a number of very promising projects.
Almost all of these projects are based on a mysterious entity called the blockchain. More precisely, not the Bitcoin blockchain, but a private blockchain called the Ethereum blockchain.
Then was a gambling-related project: etherPoker.
etherPoker is advertised as a blockchain-connected provably fair online poker game. The underlying mechanism is based on mental poker, a term coined by RSA's creators, Ron Rivest, Adi Shamir, and Leonard Adleman.
Provably fair dice, a popular extension of online coin-flipping (bit commitment) works as such:
- a server seed is generated and its hash is provided to the client
- the player inputs a client seed
- a nonce (number of times that the server seed has been used) enters the game
- the player chooses a winning range
- a magic number deterministically created from the server seed, the client seed, and the nonce is computed
- if the magic number falls in the winning range, the player wins
- the nonce is incremented for the next round
- the player can verify his numbers by asking the server to reveal the server seed
In poker, an algorithm for shuffling cards using commutative encryption would be as follows:
- Alice and Bob agree on a certain "deck" of cards. In practice, this means they agree on a set of numbers or other data such that each element of the set represents a card.
- Alice picks an encryption key A and uses this to encrypt each card of the deck.
- Alice shuffles the cards.
- Alice passes the encrypted and shuffled deck to Bob. With the encryption in place, Bob cannot know which card is which.
- Bob picks an encryption key B and uses this to encrypt each card of the encrypted and shuffled deck.
- Bob shuffles the deck.
- Bob passes the double encrypted and shuffled deck back to Alice.
- Alice decrypts each card using her key A. This still leaves Bob's encryption in place though so she cannot know which card is which.
- Alice picks one encryption key for each card (A1, A2, etc.) and encrypts them individually.
- Alice passes the deck to Bob.
- Bob decrypts each card using his key B. This still leaves Alice's individual encryption in place though so he cannot know which card is which.
- Bob picks one encryption key for each card (B1, B2, etc.) and encrypts them individually.
- Bob passes the deck back to Alice.
- Alice publishes the deck for everyone playing (in this case only Alice and Bob, see below on expansion though).
To play poker with bitcoins, the new Seals With Clubs poker site is: SWCpoker.
To play for fun, download PokerTH (Radjaïdjah Blog's alias: BluffBluff).
 A. Shamir, R. Rivest, and L. Adleman, Mental Poker, Technical Report LCS/TR-125, Massachusetts Institute of Technology, April 1979