1
$\begingroup$

I've been recently thinking about building a c++ poker game that would let players to play over sockets in a peer to peer network. However I do not know how security would be ensured. I was thinking that whenever a particular player has a turn, they alter the game state and then they broadcast this game state to the network (the other players in this game). However if the game state contains things like each players cards and the remaining cards in the deck for when a new card is revealed, how can it be ensured that particular players in the network cannot access this information and alter their play style in accordance with that knowledge.

According to this link it may not even be possible to ensure security for gaming in peer to peer network infrastructures and there's always going to be a risk of hacking?: https://cyrextech.net/security-explained-fear-the-peer-to-peer/

I know in blockchains, they ensure the validity of transactions with public/private key signatures, however this doesn't necessarily ensure security/confidentiality, just validity since it doesn't matter that the transactions are necessarily private.

Is there a way to algorithmically ensure that players cannot alter the game state to their will or is it just not possible to do this in p2p structure.

$\endgroup$

1 Answer 1

1
$\begingroup$

Is there a way to algorithmically ensure that players cannot alter the game state to their will or is it just not possible to do this in p2p structure.

Actually, this is a well studied problem within cryptography; it is known as Mental Poker. The question was "is there a way that a set of parties could play poker just by passing messages without a trusted third party", and the answer is "yes" (however it is rather nontrivial). And, while might sound like that is a rather obscure problem, it turned out that this research was the starting point for Secure Multiparty Computation (which is not at all obscure).

To start with, you might want to look at the Wikipedia article on Mental Poker; it is certainly not sufficient for you to implement it, but it would give you the basics (and has pointers to papers that go into more depth). Now, it may very well be that implementing this is more complex than you care to do at this moment, but this shows that it is possible.

On the other hand, there is one possible cheat that cryptography may not be able to address; a set of players may cooperate (show each other their cards by exchanging messages privately), and collude against another player. In the most extreme case, if there are 10 players (who get 5 cards each), then the 9 colluding players will be able to deduce that the last player's hand will be 5 cards out of a specific set of 7; that is, one of 21 specific hands. I would expect that would give them a significant advantage. A similar (if weaker) advantage would likely occur in less extreme scenarios.

$\endgroup$
1
  • $\begingroup$ Nice answer! What about active adversaries? Is there a general theoretical upper bound on percentage of the corrupted parties and security that can be achieved that has been proved for such type of cryptographic protocols, that is not limited to playing poker e.g. the state machine of poker? $\endgroup$
    – tur11ng
    Commented Dec 8, 2022 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.