SocialFi imitations have emerged again and again, and the full-chain games have been overshadowed during ChinaJoy. During this period, I have been thinking about the potential paths of Web3 Games in the future, and the most promising ones are put first: ZKP (zero-knowledge proof) + Fully On-Chain Games.
I have been experiencing the full-chain game zBingo based on ZKP (zero-knowledge proof) from @Zypher_Games since early August. Currently, 2048 and Texas Hold'em are still under development. This is a very important turning point for fair competition.
Let me first state the conclusion: ZKP will definitely become an important infrastructure in the future in ① strategy games with random attributes and ② full-chain games with incomplete information disclosure.
We divide the discussion of ZKP+Fully On-Chain games into two types:
① Fully on-chain games with incomplete information disclosure;
② Competitive games with random attributes.
Full-chain games such as Dark Forest, a strategy game named after the dark forest in "The Three-Body Problem", also use randomness as the gameplay point, focusing on Fully On-Chain Games (full-chain games) + MMORTS (massively multiplayer online real-time strategy games) + fog of war.
The fog of war represents the unknown picture. As a hidden information game, calculations are required to verify secret information. There are many points based on ZK design.
For full-chain games, the biggest feature is that all data and operations are stored on the chain, and the data exists completely on a transparent data layer. In this case, privacy protection is a big problem - I can't attack your city, and the opponent doesn't need to send scouts to monitor, but only needs to monitor the on-chain data to know all my information, right?
Depp, Japanese Mahjong, Bingo, Poker and other strategic board games with random number attributes need it even more. The first thing to do is to make them fully chained and empowered by ZKP. Otherwise, how can I trust the conscience of the dealer?
Perhaps when you play certain competitive games, you will suddenly find that why the random dropped equipment and health bottles have become less? Why are the cards turned over getting worse? This is probably not just a simple matter of luck. In the future, project owners (dealers) may need to prove that they are not engaging in black box operations.
For a competitive game with randomness, random allocation is done offline directly by hand or machine. There is a saying that "nine out of ten gamblers lose", which is both the winning rate setting of the game mechanism and there are certain insider operations.
The confidence level online is even worse. As a non-open source competitive app, we can almost be sure that the project team will adjust the mechanism and probability according to different games and ranks.
Therefore, if the project owners of future online competitive games with random distribution do not build ZKP (zero-knowledge proof) technology as their important infrastructure to prove themselves, it will be hard to convince people.
zkSNARK — The key to information hiding
Zero-knowledge proof technology has three characteristics: completeness, correctness, and zero-knowledge, which means that the conclusion is proved without revealing any details. Its technical source can also reflect simplicity. In the context of homomorphic encryption, the difficulty of verification is much lower than the difficulty of generating proof.
In the structure of a zero-knowledge proof, two roles are involved: a “prover” and a “verifier.” The prover creates a proof based on knowledge of the system input, while the verifier has the ability to confirm that the prover has truthfully evaluated the computation without knowing the input or recalculating it himself.
ZKP is definitely not a strange concept. For example, Zk-Rollup, as an effective proof mechanism, has proposed a new solution for Ethereum's expansion. Previously, everyone was busy with airdrops and interactive zkSync. Its core is to use ZK to package multiple operations into one proof and complete most of the computing work off-chain.
Or the SNARK in zkSNARK stands for "Succinct Non-Interactive Arguments of Knowledge". The succinctness is because the proof in zkSNARK is only a few hundred bytes, which makes it easy for the verifier to quickly check whether the proof is correct; and the non-interactive proof eliminates the need for the verifier to question the statement submitted by the prover.
We just mentioned that for a fully on-chain game, all data and operations are stored on the chain, and it is difficult to protect privacy if the data exists entirely on a transparent data layer. For example: randomly generated coordinates, the player's birth point, the remaining cards in your hand, and every card you play - can all be queried through on-chain data.
With the technical support of zkSNARK, players can maintain their privacy while publicly submitting verifiable and valid actions. In this way, participants no longer need to submit specific operation information of their own on-chain behavior directly to the chain, but only need to submit a commitment to the operation behavior and a hash-valid zero-knowledge proof, so there is no need to worry about others knowing their cards.
What are the requirements for privacy of incomplete information in full-chain games? Games like chess and Chinese chess that do not require privacy at all and only require strategic games certainly do not need the technical bonus of ZKP.
But be careful with mahjong, chess, and strategy games with incomplete information, especially GameFi and competitive games.
So it is still necessary for the following three games:
① Full-chain games with partial information hiding requirements
② Card-shaped full-chain game that requires shuffling and drawing lots
③Full chain of asynchronous games
To add, asynchronous games refer to the implementation of non-real-time player game interaction mechanisms.
Example: Zypher Games’ full-chain ZK+ game mechanism
For these three types of games, we will use the three existing game mechanisms designed based on the self-developed zk-Game SDK in Zypher Games to illustrate how to achieve the on-chain information asymmetry required for full-chain game development.
Among them, the full-chain asynchronous game can directly refer to Dark Forest. Zypher Games has also launched a universal zero-knowledge game engine (UZKGE) to help the development of full-chain card games, such as computational provability, scalability and concurrency, and on-chain data/information asymmetry.
zBingo: A full-chain game with partial information hiding requirements
Bingo seems to be more popular in the West, so I spent a long time studying how to play this game.
The rules of the game are that you will first get a "randomly generated" card filled with a random number between 1 and 36. Of course, this generation is also based on ZK. The gameplay is relatively simple:
① At the beginning of the game, you will get a 5x5 grid card filled with random numbers between 1 and 36. The specific layout of this grid card is randomly generated and only you know it.
②After the matching is completed, players take turns to select numbers on their grid cards. The selected number is announced and marked for any player with that number on the grid card.
③The first player to complete two lines (horizontally, vertically or diagonally) wins the round.
In fact, the gameplay is quite simple. Let’s mainly talk about the mechanism and see where your gas is spent.
① Generate a grid card composed of random numbers, so the first signature is used here;
② The encryption of the grid card requires a one-time encryption key. Before the encrypted signature operation, you can generate a grid card at will, but it cannot be changed after the encryption is completed;
③Submit the encrypted grid card and enter the pairing process, which is the first gas fee expenditure;
④Matchmaking, matching your opponents for you, which is the second Gas fee expenditure;
⑤ Next, gas will be charged at every step. Every time a card is opened, the gas fee will be paid.
⑥End, upload the proof, and perform the If operation. The winner can get the zBingo blind box, and then open the Zynizens NFT.
I calculated that after two rounds of zBingo games, a total of 0.0031 BNB was spent, and the average gas fee for each game was about 2.40 yuan.
In fact, the gas cost of playing this kind of casual game is still not low, mainly because gas is required for every step of the game on the entire chain, so we are looking forward to lower fees and faster operations after the Cancun upgrade.
zACE: A full-chain card game that requires shuffling and drawing
Finally, let’s talk about the design differences in the mechanisms of full-chain chess and card games. zACE demonstrated a card game based on Zypher Games’ zk-Game SDK that requires shuffling and dealing cards, similar to Texas Hold’em.
In fact, the SDK realizes a high-performance, low-cost decentralized shuffling process through optimized wasm and precompiled contracts. Its on-chain randomness no longer requires traditional VRF, achieving decentralization and fair shuffling and gaming.
VRF stands for Verified Random Function. A Verifiable Random Function (VRF) is a random number generator (RNG) that can be cryptographically verified for randomness. Many L1 blockchains, including Algorand, Cardano, Internet Computer, and Polkadot, use VRF in their consensus mechanisms to randomly select block producers.
However, due to the highly deterministic nature of blockchain networks, secure RNG random number generators are generally not available on-chain.
There is a risk of being manipulated by miners or validators when using on-chain block hashes to generate random numbers. These individuals responsible for verification can choose to abandon blocks that are unfavorable to them and regenerate random numbers until they are favorable. This is why ZKP+ full chain is so important.
Z2048: Full Chain 2048
The developers of the Zypher Games platform are preparing to launch a game called "Z2048", a fully blockchain-based game based on the popular casual sliding number game 2048.
How to play: In a 4*4 square grid, there are two random numbers 2 on the initial board. The player uses the arrow keys to move the numbers on the board so that the same numbers in the same direction are added and moved to the other side of the direction. Each move will add a 2 or 4 to a random position on the board.
When the player reaches 2048, he or she can choose to upload ZKP to end the game, or continue to challenge for a higher score. If the board is completely stuck and cannot be moved, the game is over.
Platform NFT can increase game time and resurrection rights. In this game, ZKP is used to achieve scalability.
ZKP-Proved, here, instead of requiring every step to be committed to the chain — which would require players to sign a transaction for each step — the smart contract bundles the steps together and generates a zero-knowledge proof.
This proof is then stored on the blockchain, providing cryptographic verification that the outcome of the game is both immutable and fair, while keeping specific gameplay details confidential. This is achieved by combining traditional gameplay with state-of-the-art Zero-Knowledge Proof (ZKP) technology and a competitive element.
UZKGE: A zero-knowledge game engine with a highly optimized Plonk library, which is a complement to a rapidly expanding zero-knowledge (ZK) circuit library, carefully crafted to meet the diverse needs of game developers.
These circuits facilitate complex calculations that ensure the integrity of game mechanics while protecting player privacy, and these cryptographic techniques enable game developers to verify critical gameplay data without revealing underlying details.