Welcome to the BLOG!  As you might have heard by now, CHIPS Pangea Poker is a fully decentralized peer-to-peer gaming system which doesn’t rely upon any third party for trust.  It is entirely non-custodial: this means that as a user/player you:

  • maintain ownership of your coins while you play (with the privkey),
  • gain the ability to host your own private games with your friends online, and
  • do not need to send your money to a centralized entity nor do you need their permission.

That’s because CHIPS Pangea Poker is entirely on-chain: therefore it is completely decentralized & trustless, ruled by mathematics, provable, immutable, permissionless.  This is actually a tremendous achievement which deserves some explanation.  In fact there is a name for this set of problems having to do with playing a fair game of poker over a distance without using a trusted third party - it’s called “Mental Poker.”

The Problem of Mental Poker

The problems of mental poker, or, trustless decentralized p2p poker, have been considered for decades.  For years  jl777 has been creating solutions to blockchain & decentralization roadblocks.  He has done pioneering work in the field of cross chain atomic swaps, multi-chain architecture, and many more areas, including what he calls “one of the most demanding usecases, realtime poker.”  The concept of decentralized poker brings forth the potential of p2p computing networks, as it showcases the complex functionality required to make it happen.

“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.”

Multichain Decentralized Cashier For Gaming by jl777

A handful of years ago with this in mind, jl777 & sg777 initiated a cryptographic mathematical paper & implementation for Pangea Poker.  Ultimately the goal would be to have a 9-player Texas Hold'em game that could be played fairly over a decentralized network.

In order to create the blockchain activity required for Pangea Poker protocol, jl777 created CHIPS, a Bitcoin fork with 10-second block times & Lightning Network. Lightning Network enables the real time betting while minimizing transaction fees, since each action (check, raise, call) would be a transaction on the blockchain.  The payout is distributed on-chain at the end of each hand.

The Pangea Poker Solution

Quite like building a gigantic feat of structural engineering like a huge bridge, this feat of computer software engineering is met with numerous challenges based on the laws of reality.  In this case of engineering a decentralized poker game, the critical tech involves the card deck handling and the funds handling.  Making sure that the deck was not tampered with in any way is absolutely necessary. To achieve this, PANGEA uses a method similar to coin shuffling and all participants are involved in the process of deck shuffling.

Another challenge is the bandwidth of executing such a game of poker.  The limitations with the other known methods for mental poker protocols are that they require a lot of bandwidth and are not as fast as PANGEA, which uses a single curve25519 field multiplication for the vast majority of its encrypt and decrypt functions. This improves an order of magnitude in speed and reduction of bandwidth required.

Player disconnections requiring reconstruction of the playing deck, and collusion, are two other problems that arise.  A lot of math is required to enable trust in such scenarios.

Pangea Protocol

Pangea protocol consists of three entities and is designed such that it is impossible for any of the entities to collude:

  1. Deck Creating Vendor (DCV) = the Dealer node
  2. Blinding Value Vendor (BVV) = the Cashier node that reconstructs & distributes the deck if a player disconnects; also keeps information unknown to participants
  3. Players (P) = the Player node for users who want to play the poker game

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 sign off on the payout being made.

Since this is a p2p decentralized network of poker, everyone plays a computing role by running CHIPS nodes.  These roles are cashier node, dealer node, and player node.  The required p2p networking and dealer nodes is built into the chipsd.

CARD DECK CREATION

The group-generated “deck” is really just a set of sequential numbers that are all shuffled and available as faceup (public) or facedown (private) “cards” that are provable to all the nodes when the time comes.

Player

Each player generates random numbers as index of the cards. Permutation followed by blinding protects the cards from being revealed by DCV (so even if DCV & BVV collude they can’t guess final sequence of shuffled cards). Player signs & publishes values into authenticated initial deck submitted to DCV (verifiable by any entity in the game).

DCV

DCV receives shuffled, blinded cards & authenticated vector from each player. For each card of each player, DCV generates random numbers. Further blinding occurs. Each player deck is encrypted & hashed using SHA-256.  Encrypted Deck for each player is blinded to other players and BVV.  DCV shuffles each encrypted deck such that sequence of the cards is unknown to player & BVV.  

The shuffling of DCV is only published if required at the end of game to validate correctness & resolve disputes.  The end result is the Raw Deck created by DCV & signed to authenticate it so nobody can spoof the role of DCV.

BVV

BVV receives raw deck and set of authenticated vectors from DCV. BVV generates set of blinding values for each player. The deck received from DCV is shuffled & encrypted by BVV to prevent collusion between players and DCV.  BVV shuffling is published at end of game validate correctness & resolve disputes.  BVV signs the shuffled encrypted deck so nobody can spoof its role.

Player

Raw deck received is the set of values published by DCV and BVV.

HANDLING OF THE DECK

The cards in the deck will get revealed as the game progresses.  

Players possess the raw deck but they can’t reveal the cards since they are blinded by the blinding values which are split into shamir secret shares & distributed among the players. After undoing the initial permutation, all players have the deck which has the permutation applied by DCV and BVV only, so this deck has the same sequence for each player but no one knows what card is in which slot.  

As cards are distributed from the deck to each player and then revealed to the player, the information must also be blinded for everyone else - therefore to reconstruct the blinding value, the player requests the shamir secret key from players and DCV which had previously been split and distributed. Each player encrypts this corresponding shamir shard with the requesting player’s public key and sends it, so that none of the other players can reconstruct the corresponding card value.

Using mathematical computations the player is able to decrypt and reveal the card in the deck sequence, which is the earlier combined shuffled result of DCV and BVV.  In case of a failure to receive required shards, then BVV steps in to perform reconstruction & redistribution of the deck.

NON-REPUDIATION & CORRECTNESS OF THE GAME

To ensure fair play, every move of the game can be authenticated and validated. Each player possesses authenticated vectors from the other players, from DCV, and from BVV. The authenticated vectors of all participating entities are published, to resolve any disputes and to validate the published decks from the entities.  As the game finishes every player reveals cards such that any player can verify cards from any other player, and, DCV verifies the revealed cards and evaluates the game. Since all entities possess the authenticator vectors, any player can verify and ensure  fair gameplay.

HANDLING OF FUNDS

  • At the start of the game: players deposit funds to the cashier node (BVV) multisig address where they are locked.
  • At the end of the hand: the dealer node (DCV) & Player nodes communicate to BVV the outcome of the game - if BVV verifies it as accurate then it spends the multisig transaction & deposits the funds to the winning Player.  If not enough players sign, the funds are not correctly distributed and remain stuck; in some cases this could be due to players quitting or disconnections. In such cases the Player node can request BVV to return funds back.

(Download the original paper from jl777 & sg777 here, explaining all the finer details including mathematical equations.)

CONCLUSION

The Pangea Poker game is based on blockchain technology that enables hands of poker to be validated and played with no trust for the people you’re playing with, and no other need for third party involvement. Because it’s a truly decentralized p2p network and each participant has to connect a node, disconnections are inevitable due to reasons such as players purposefully quitting, or disruptions to internet connection, etc. A decentralized poker game should be able to reconstruct the deck and have the capability to take the game forward in case any of the players gets disconnected during play. Reconstruction of the deck preserves the state of the game, since the newly generated deck is the same sequence of cards as the original sequence, and once it gets distributed to the players the game resumes.

With the launch of the Pangea Poker dApp alpha release, crypto enthusiasts and poker enthusiasts can intersect in a new paradigm of decentralized, trustless, permissionless gaming.

To learn more check out our website and github.  To connect with the community and join some poker games come visit CHIPS Discord server.