CHIPS + LightningNetwork + PANGEA + CC = blockchain enforced realtime poker and other games
Decentralized poker is quite a difficult problem for various technical reasons, but especially the requirement for all players to be able to have the same deck, but without any single participant having any extra information. Additionally, both face down and face up cards are needed, which creates the need for encryption to hide the face down cards, but later to be able to let all participants decrypt it, without anybody being able to decrypt before they are supposed to. Oh, and all this needs to happen in realtime to keep pace with people playing online poker.
To get a deeper idea of why it is hard: https://blog.cryptographyengineering.com/2012/04/02/poker-is-hard-especially-for/
When I first started to work on this problem, i didnt see a clear picture of how all the pieces would be solved, let alone how it would be put together. I knew we needed a realtime payments system, so I experimented with the much maligned Lightning Network, but using it in a simple hub and spoke model sidesteps the biggest weaknesses of LN. Of course, we cant be waiting for 20 minutes (2 confirmations) for channels to be created, so I needed a fast blocktime LN compatible coin, hence CHIPS was created.
Using the basic idea from coinshuffle, I solved how to create and shuffle the deck and deal the cards faceup and face down, with everything all verifiable and with help from sg777 it was improved so that nobody has any advantage of knowing cards ahead of when they should. Using curve25519 primitives, the operations are fast enough to handle 9 player texas poker in realtime. So that was the first step, but going from a proof of concept to a working system requires more than just solving one of the really difficult problems. All aspects need to be solved.
With decentralized poker not in the main path of komodo development, I had to offload the development work to sg777 who has tirelessly been making steady progress through the years. This was all started back in the 2016/2017 timeframe and we had to struggle with LN as it was evolving from alpha to beta.
As you know, in parallel, komodo developed CC and more specifically Proof of Gameplay, which in turn was inspired by the requirements of pangea poker. Now until recently it was clear how the pangea would fit into CC, but with the recent completion of the GUI integration, we are two steps away from the full solution!
Before I describe the full architecture, let me describe the concept of a gameengine as it applies to pangea games. The group generated “deck” is really just a set of sequential numbers that are all shuffled and we are able to have faceup (public) or facedown (private) “cards” that can later be proven to all the nodes. this is without using any super difficult zero knowledge techniques as I am certainly not any Matt Green! There is a math paper that goes into all the details if you are curious about these details: https://medium.com/@jameslee777/chips-decentralized-poker-protocol-65cedeafde38
Our first implementation was based on texas holdem poker, but of course any poker variant can be done, in fact any card game can be done and generalized to any multiplayer game that requires a common set of random results, like roulette, slot machines, etc. etc. For each game, there are all the game specific rules about how the game is played, when bets are allowed, how much is allowed to be bet and how to determine who won. We will assume all these details are encapsulated into the gameengine and that there is a gui that allows users to interact with the core to play the game.
What this means is that the same basic method can be used to create entire family of blockchain enforced multiplayer chance based games, or games of skill with elements of chance. During the game, all the players form a p2p network and broadcast signed messages to denote their actions, and bets are made with LN transactions. At the end of the game, all nodes are able to verify the result and signoff on the payout being made. This eventchain is the same as the proof of gameplay user events log that is then replayed to determine the final gamestate, it is just a record of all player actions. In poker there is what is called a hand history and that is basically what it is, just cryptographically signed along with crypto transactions.
The current implementation still has a trust point in the dealer as the players are making LN bets to the dealer and we need to trust that the dealer will make the proper payout. Of course this is insufficient to be fully decentralized, but it is just the second to last step!
The next step is to have a set of multisig signers, where the players deposit funds to and get a set of table chips in return. The amount of actual LN funds used for making bets will just be the minimum size LN tx, but it could represent any amount of funds, even a full BTC per chip. now that would be a high stakes table!! At this stage, at the end of the game, all the multisig signers will verify the payout from the proof of gameplay and sign a multisig transaction to the winning player. The CHIPS will always be needed to play the realtime game and play the game on a specific table, as the required p2p networking and dealer nodes is built into the chipsd. Each dealer can choose what denomination the table chip represents, from multiples of CHIPS to play using the native currency, or ANY external komodo chain with CC enabled!
With all the variety of komodo CC chains that are possible, this means bets can be denominated in KMD sidechain, USD stablecoin, or literally millions of possible denominations using the -ac_pegs technology described in a separate post. Even a BTC sidechain can be supported. It would also be possible to support normal coins without CC as the multisig level support can be used assuming we have a set of multisig signers we can trust to safekeep the funds.
In komodo ecosystem, the notary nodes provide such a set of multisig signers, so indeed, BTC can directly be used. however, BTC suffers from expensive txfees and slow blocktimes, so from a practical standpoint, using coins like KMD with 1 minute blocktimes and low txfees would be preferred.
Of course, making a poker specific CC that replaces the multisig deposit/payout mechanism makes this a fully decentralized trustless realtime poker!
With dozens of other possible games, and nearly infinite number of dealer tables that can be created.
It has taken years to get this far, but now the finish line is in sight and CHIPS has a critical role in all the game play usage and by having it combine so elegantly with CC proof of gameplay, brings CHIPS fully into the komodo ecosystem.