ZKP+Fully On-Chain Game The Foundation of Fair Competition
ZKP+Fully On-Chain Game Fair Competition FoundationSocialFi’s imitation platform has emerged again and again, overshadowing the momentum of the entire blockchain gaming industry at ChinaJoy. During this time, I have been contemplating the potential paths for future Web3 Games, and the most promising one is: Zero-Knowledge Proofs (ZKP) + Fully On-Chain Games.
I have been experiencing zBingo, a fully on-chain game based on ZKP, in @Zypher_Games since early August. Currently, 2048 and Texas Hold’em are still under development, which is a significant turning point for fair competition.
First, let me state the conclusion: ZKP will definitely become an important infrastructure in both ①strategy games with random attributes and ②fully on-chain games with incomplete information disclosure.
- The Block Editor-in-Chief 5 Innovative Projects Worth Paying Attention to
- Arbitrum Incentive Program A Look at the 5 Projects Supported by Wintermute
- Starknet Analysis of the Advantages of the Full-Chain Gaming Ecosystem Development and High-Quality Projects
When discussing ZKP + Fully On-Chain games, there are two types:
①Fully on-chain games with incomplete information disclosure;
②Competitive games with random attributes.
An example of a fully on-chain game is Dark Forest, a strategy game named after the “Dark Forest” in the novel “The Three-Body Problem”. It is known for its randomness and features Fully On-Chain Games + MMORTS (Massively Multiplayer Online Real-Time Strategy games) + fog of war.
The fog of war represents the unknown. As a hidden information game, it requires computation to verify secret information, and there are many points based on ZK design.
For fully on-chain games, the biggest feature is that all data and operations are stored on the blockchain. The data exists entirely on a transparent data layer, which raises a major issue of privacy protection. For example, if I attack your city in the game, the opponent doesn’t need to send scouts to monitor me. They can simply monitor the on-chain data to know all my information, right?
This is even more necessary for games like Texas Hold’em, Mahjong, Bingo, and Poker, which have random number attributes. The first thing to do is to fully migrate to the blockchain and empower them with ZKP. Otherwise, how can I trust the integrity of the dealer?
Perhaps while playing certain competitive games, you may suddenly notice that the randomly dropped equipment and health potions are becoming scarce. The cards you flip are getting worse and worse. This is probably not just a simple matter of luck. Future project teams (dealers) may need to prove that they have not engaged in any manipulative operations.
For a competitive game with randomness, offline random distribution by human hands or machines is often associated with the saying “ten gambles, nine losses”. This not only sets the winning rate of the game mechanism but also involves certain insider operations.
And the credibility of online games is even lower. As a non-open-source competitive app, we can almost be certain that the project team will adjust the mechanisms and probabilities based on different matches and skill levels.
So in the future, for online competitive games with random distribution, if the project party does not build ZKP (Zero Knowledge Proof) technology as its important infrastructure for self-certification, it will be difficult to convince people.
zkSNARK – Key to achieving information hiding
Zero Knowledge Proof technology has three characteristics: completeness, correctness, and zero knowledge, which means proving the conclusion without revealing any details. Its technical origin can also reflect simplicity. In the context of homomorphic encryption, the difficulty of verification is far lower than the difficulty of generating proof.
In the structure of Zero Knowledge Proof, there are two roles: “prover” and “verifier”. The prover creates a proof based on the knowledge provided by the system, while the verifier has the ability to confirm that the prover has accurately evaluated the computation without knowing the input or recomputing it.
ZKP is definitely not a strange concept. For example, Zk-Rollup, as an effective proof mechanism, has proposed a new solution for scaling Ethereum. Previously, we were busy with zkSync, which interacted with airdrops. Its core is to use ZK to bundle multiple operations into one proof and complete most of the calculations off-chain.
Or in zkSNARK, SNARK stands for “Succinct Non-Interactive Arguments of Knowledge”, which means concise non-interactive knowledge arguments. Specifically, zkSNARK proofs are only a few hundred bytes, making it easy and fast for verifiers to check the correctness of proofs; and non-interactive proofs allow verifiers to accept the statements submitted by the prover without questioning them.
As we just mentioned, for a fully on-chain game, all data and operations are stored on the chain, making it difficult to protect privacy when data is completely transparent. For example, random generated coordinates, players’ starting points, the remaining hand cards in your hand, and every card you play can all be queried through on-chain data.
However, with the support of zkSNARK technology, players can maintain their privacy while publicly submitting verifiable valid actions. In this way, participants no longer need to directly submit specific operation information of their on-chain behavior to the chain, but only need to submit a commitment to the operation and a zero-knowledge proof with a valid hash, so there is no need to worry about others knowing their own cards.
What are the requirements for incomplete information privacy in fully on-chain games? For games like chess and Chinese chess that do not require privacy at all and only need strategic gameplay, there is no need for the enhancement of ZKP technology.
But for mahjong and card games, as well as incomplete information strategy games, especially GameFi and competitive games, one must be cautious.
So it is necessary for the following three types of games:
① Full-chain games with partial information hiding requirements
② Full-chain card games that require shuffling and drawing
③ Full-chain asynchronous games
By the way, asynchronous games refer to the implementation of non-real-time player game interaction mechanisms.
Example: Mechanism of Zypher Games’ Full-chain ZK+ Games
For these three types of games, let’s take Zypher Games as an example. We will use three game mechanisms designed based on the self-developed zk-Game SDK to illustrate how to achieve the required on-chain information asymmetry for full-chain game development.
For full-chain asynchronous games, you can refer to Dark Forest directly. Zypher Games has also launched a universal zero-knowledge game engine (UZKGE) to assist in the development of full-chain card games, such as computational provability, scalability, concurrency, and on-chain data/information asymmetry.
zBingo: Full-chain game with partial information hiding requirements
Bingo seems to be quite 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 receive a “randomly generated” card filled with random numbers from 1 to 36, and this generation is also based on ZK. The gameplay is relatively simple:
① At the beginning of the game, you will receive a 5×5 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 selecting numbers on their own grid cards. The selected number is announced and marked for any player who has that number on their grid card.
③ The first player to complete two lines (horizontal, vertical, or diagonal) wins the round.
The gameplay is actually quite simple. Let’s mainly discuss the mechanism and see where your Gas is being spent.
① Generating a grid card composed of random numbers, so the first signature is used here;
② The encryption of the grid card requires the use of a one-time encryption key. Before the encryption signature operation, you can generate a grid card at will, but it cannot be changed after this encryption is completed;
③ Submit the encrypted grid card and enter the matching process, which is the first expenditure of Gas;
④ Matchmaking, matching you with your opponent, which is the second expenditure of Gas;
⑤ Next, you have to pay Gas for each step, and you have to pay the fee for flipping a card;
⑥ End, upload proof, and perform If operation judgment. The winner can get a zBingo blind box, and subsequent Zynizens NFTs can be obtained.
I calculated that after two rounds of zBingo games, a total of 0.0031 BNB was spent, and the average gas fee for each round is about 2.4 yuan.
Actually, the gas cost of playing such casual games is not low, mainly because every step of the game on the entire chain requires gas. Therefore, I am looking forward to the upgrade of Kanqu, which will have lower fees and faster operations.
zACE: A Full-Chain Card Game that Requires Shuffling and Drawing
Finally, let’s talk about the design differences in the mechanism of full-chain card games. zACE demonstrates a card game based on Zypher Games’ zk-Game SDK, which requires shuffling and dealing cards, similar to Texas Hold’em.
In fact, the SDK achieves high-performance and low-cost decentralized shuffling through optimized wasm and precompiled contracts. Its on-chain randomness no longer requires traditional VRF, achieving decentralization for fair shuffling and gaming.
VRF stands for Verifiable Random Function. Verifiable Random Function (VRF) is a type of random number generator (RNG) that uses encryption methods to verify randomness. Many L1 blockchains, including Algorand, Cardano, Internet Computer, and Polkadot, use VRF in their consensus mechanisms to randomly select block-producing nodes.
However, due to the high determinism of blockchain networks, secure RNG random number generation is usually not available on-chain.
Using on-chain block hashes to generate random numbers carries the risk of manipulation by miners or validators. These responsible individuals can choose to abandon blocks that are unfavorable to them and generate random numbers again until they are favorable. That’s why ZKP+full-chainization is important.
Z2048: Full-Chain 2048
The developers of the Zypher Games platform are preparing to launch a game called “Z2048,” which is a full-chain adaptation of the popular casual sliding number game, 2048.
Gameplay: In a 4×4 grid, there are initially two random numbers, 2, on the game board. Players use arrow keys to move the numbers on the board, combining the same numbers in the same direction and moving them to the other side. Each move adds a random 2 or 4 to a random position on the board;
Players can choose to upload ZKP to end the game when they reach the number 2048, or continue to challenge higher scores. If the game board is completely blocked and cannot be moved, the game ends.
Platform NFTs can increase game time and resurrection rights. In this game, ZKP is used to achieve scalability.
ZKP-Proved, here, smart contracts do not require every step to be submitted on-chain – this would require players to sign a transaction for each step – instead, these steps are bundled together and a zero-knowledge proof is generated.
This proof is then stored on the blockchain, providing encrypted verification to ensure that the game’s outcome is both immutable and fair, while maintaining the confidentiality of specific gameplay details. By combining traditional gameplay with state-of-the-art zero-knowledge proof (ZKP) technology and competitive elements.
UZKGE: Zero-Knowledge Game Engine, with a highly optimized Plonk library, is a complement to a fast-growing Zero-Knowledge (ZK) circuit library, carefully crafted to meet the diverse needs of game developers.
These circuits facilitate complex computations, ensuring the integrity of game mechanics while protecting players’ privacy. These encryption techniques allow game developers to verify critical game data without revealing potential details.
We will continue to update Blocking; if you have any questions or suggestions, please contact us!
Was this article helpful?
93 out of 132 found this helpful
Related articles
- Using Meme coin to launder funds from Rug Pull projects, revealing the true identity of the PEPE trader.
- Summary of the DeFi Market in the Third Quarter Three Major Narratives and Three Major Projects
- What is Neutron project Binance leads investment and token goes live after 4 months.
- After half a year of suspension, the vice president of iQiyi’s NFT project switches to a new NFT project.
- New project in the Web3 social track In-depth analysis of KOL time trading platform Time Store.
- Overview of Outlier Ventures’ 6 Cosmos investment portfolio projects
- Summary of the latest Ethereum core developer execution meeting Devnet-9 launch delayed again, Holesky test network validator participation rate close to 80%.