Zero knowledge proofs for gaming: how it works & why do we need them
ZK technologies become more and more popular. People expect them to bring the completely new UX to everyday life and start generation of products with previously impossible possibilities.
While ZK proofs found their use in different application areas in this article we will focus on how proofs can bring the completely new gaming experience.
To explain what is ZK gaming let’s dive into how ZK proofs work. Imagine you’re a chess fan and you go to a chess club. Club teacher gave all the students a chessboard configuration for a homework and asked to checkmate in the minimum amount of moves playing against the same AI algorithm. You managed to finish game in 7 steps. It was so cool that your friend haven’t believed your result and asked to prove it.
The problem is, you can’t share your moves with your friend – he can then show the same steps on the next lesson and say he came up with the solution by himself. While arguing, your mutual friend came and said that he checkmated in 5 steps. You’re pretty sure that it’s impossible and asked to prove. But he refused to show his moves for the same reason
ZK proofs are here to help. You can create a black box — ZK circuit based on public data – initial chess configuration and public algorithm — chess rules and bot AI algorithm. Then you can can put private data — your moves into the box. Box will process the private data — apply you moves, verify you checkmated and give you proof that you checkmated using N moves.
This proof can’t be used to know your moves. However you can send this proof to your friends and they can use the verifier part of the blackbox to check you really checkmated in the exact number of moves.
This blackbox can be created by writing ZK program and compiling it using special toolchain. For this purpose circom language can be used. However this language is complex and not easy to migrate game logic to and has low interoperability with frontend — it’s hard to synchronise the state on frontend and inside the circuit. In this case o1js and Mina protocol comes into play – they allow to write zkapps in typescript, give network for proofs, allow interoperability with frontend and game logic portability
All the students liked the idea and created proofs for their moves. They managed to create an internal scoreboard where all the scores are verifiably correct while nobody knows how other players achieved the result. It turned out that your result was the best, and the result of a mutual friend was fake
Check game is just a simple example of a game with provable game process. More interesting and complex games can be proved as well. In ZkNoid we implemented an arkanoid game where all the game state changing based on user input is proved. In the next articles we will cover technical aspects of a complex game verification and what benefits provable games bring to players and businesses