In a previous article I describe how you can shuffle a deck among a group of players using Ethereum. This deck would have all the properties you would want for games like Texas Hold’em. As a group, cards can be dealt and revealed to individuals or the table. Nobody would know what unrevealed cards could be.

This article turned out to be pretty popular. Many people had suggestions, compliments and complaints. After reading everyones feedback I’m still pretty confident that this works. Some day I hope to write the actual solidity code. Or maybe someone else could (please?)

Now I want to document how the entire game could work. I’m describing tournament play. In this type of game, players buy-in and receive chips. The game continues until one player has all the chips and wins the pot. The patterns of this design could be used for other types of games or applications. Ok, here we go.

First, announce your game

A player does this by constructing a Texas Hold’em smart contract. The input parameters here would be the buy-in (represented as included Ether that goes along with the contract), max players, timeout and their array of shuffled indexes and a signature. If the timeout passes and no one joins, their Ether is returned to them. Now a game is published to the Ethereum blockchain for everyone to see! Cool. Other players can join by paying the equivalent amount of Ether. Players do not need to receive any kind of Ethereum token for their chips. It’s understood that each player has, say a million chips at this point.

Second, begin play

Players then follow the rules of the game by taking turns. They sign each of their decisions in the game including how many chips they bet. They also follow the rules of the deck by revealing the appropriate shuffled index for that phase of the game. All of this can happen off chain. We do not need to wait for the blockchain. Each player keeps a journal of everyones moves.

Finally, verification

When a player wins they submit their journal as a transaction to the Texas Hold’em contract. This contract verifies that all moves are legal and signed correctly. Meanwhile all other players are able to tell that this is happening because the transaction is on the blockchain.

If a player prematurely declares that they won, the other players can submit longer journals before the timeout, demonstrating that play should continue. If a player makes an illegal move, clients can also be sent to the verifier causing a fold.

The mechanism also solves player timeouts. If a player refuses to reveal a shuffled index or take their turn then the other players can submit their journal which will effectively time this player out and cause them to fold, unless of course the stalling player makes their move and submits their journal. (as a note, the remaining cards need to be reshuffled if a player times out)

Conclusion

This is my design for Dealerless Texas Hold’em. It has many nice properties including Game announcement using the blockchain, Off blockchain low latency game play, timeouts and blockchain verification. This design also doesn’t have the possibility for catastrophic bugs. Because each game is played around a single contract, if someone finds a way to exploit it then only that one game is affected. Future contracts could fix the bug. This should be a design pattern of any Ethereum contract of course. I also find the pattern of “instantiate on chain->off chain play->verify on chain” to be potentially useful to other applications.

I’m not solving the very difficult problem of collusion. It also seems possible to stall the game play though constant verification requests. Writing the code will take more effort and will probably uncover other challenges and enhancements. A client would probably also need to be written in order to play the game reasonably. It’s still cool to think that something like Ethereum could revolutionize online gambling.