Author: Yooma; Source: MetaCat
Problems encountered
PopCraft is a full-chain elimination game. Each game lasts 4 minutes. Players will receive token rewards if they eliminate all elements on the board within the specified time.
Due to the full-chain characteristics, every operation of the player during the game needs to interact with the blockchain. The block time of Ethereum Layer 2 is usually 2 seconds, which means that players need to wait at least 2 seconds to complete each operation in the game, which is much longer than the waiting time in similar Web2 games, making the PopCraft game experience poor.

PopCraft game main interface
Conceived solution
We envision using zero-knowledge proof technology (hereinafter referred to as ZKP) in PopCraft to reduce the number of interactions between players and the blockchain during the game.
The expected approach is: The game process is not on the chain, but there is a mechanism to ensure that there is no risk of cheating. Each operation of the player in the game will generate a ZKP, and the ZKP of the next operation is generated based on the ZKP of the previous step, thus forming a self-contained ZKP similar to the blockchain structure. At the end of the game, the ZKP of the last operation is sent to the chain and the result is verified by the smart contract.
Solution Research and Derivation
1. Anti-cheating of game process and results: It is not enough to generate ZKP only for the game results, because there is also the possibility of cheating in the game process. Therefore, it is necessary to generate ZKP for the game results and verify the game process.
2. Technical challenges of gradually generating ZKP: In order to prevent cheating, it is necessary to generate ZKP for each operation of the player in the game, and at the end of the game, the last ZKP is put on the chain for verification. In this process, each ZKP will depend on the previous ZKP until the game is over.
But the difficulty is:
1> The generation of a new ZKP needs to depend on the previous ZKP, which makes the verification process complicated and uncertain whether it can be implemented. In addition, ZKP verification is done through smart contracts (on-chain), so how to verify that the previous ZKP is correct when generating ZKP in the next step.
2> When verifying whether the ZKP of each step is correct through smart contracts, how to ensure the consistency of each ZKP with the previous ZKP, this problem is uncertain whether there is a solution.
3. The problem of public game data: PopCraft's game data is public, so it is unnecessary to hide information through ZKP. If the above verification steps can be achieved, the next step is to consider saving the game data on the contract side. However, the problem is that the nature of ZKP cannot solve the specific game data, and the game result data transmitted to the smart contract by the client cannot be directly trusted at this time, which means that the smart contract cannot directly store this data.
4. The problem of consuming game props in PopCraft: When the game process involves the elimination of isolated elements through game props, it essentially corresponds to the consumption of tokens, and the corresponding tokens in the user's wallet need to be transferred. How to handle this step of ZKP generation and verification is also a problem.
1> A possible solution is: This step continues to generate ZKP according to the previous process, verifies the number of tokens consumed and finally sends it to the smart contract. However, since the smart contract cannot obtain specific game data through ZKP, it is impossible to determine the number of tokens that should be transferred.
In addition, assuming that a player has 3 Token A but tries to consume 4 Token A in the game, this error will be discovered at the end of the game, rather than in real time when the user operates.
2> Another possible solution is: When using Token to eliminate isolated elements, directly interact with the smart contract to complete the elimination, and then update the player's Token balance. The generated ZKP is only responsible for saving the proof of the game operation and status at this time.
Then at this time, after the token transfer is successful, it is necessary to continue to generate ZKP as in the previous operation. If it is not generated, then between the ZKP generated in the previous step of the token transfer operation and the ZKP generated in the next step, there is an additional step of interacting with the smart contract, then the game status in the ZKP will conflict, so whether the ZKP generated at the end of the game is valid is also an unresolved issue.
5. Data hiding problem of ZKP: For scenarios like PopCraft where game data does not need to be hidden, data hiding through ZKP is redundant, and it increases the difficulty of obtaining game data and the uncertainty of engineering implementation solutions. PopCraft only needs to ensure that there is no risk of cheating in the game process and results, and does not need to hide the game process data.
Conclusion
In games like PopCraft, game data does not need to be hidden, so it is unnecessary to use ZKP to hide information. In order to improve the gaming experience by shortening the response time, it is possible to consider not putting the game process on the chain, but only putting the final result on the chain. The key is to find a way to ensure that there is no possibility of cheating from the first step to the last step of playing the game, and finally put the correct result on the chain for verification.
If information is hidden through ZKP, it will increase the difficulty of engineering implementation. The second is how to ensure that there is no risk of cheating during the game process. Using ZKP can ensure that there is no risk of cheating in a single game operation, but in order to reduce the number of interactions with the blockchain, ZKP cannot be generated and submitted once. So how to ensure that there is no risk of cheating from the first operation at the beginning of the game to the end of the game? At present, it seems that ZKP cannot solve this problem.
From our research, ZKP in the game field is suitable for two types of things:
Information hiding of non-complete information game games, such as: Dark Forest, Texas Hold'em, Werewolf, Hearthstone, etc.
The game process is a single-step game result proof, such as: lottery, guessing numbers, rock-paper-scissors, dice games, etc.
Due to our limited knowledge of zero-knowledge proof technology, this article may contain factual errors or unreasonable engineering assumptions. We sincerely ask for criticism and correction from experts in the field of zero-knowledge proof with rich experience.