ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

CN
PANews
Follow
1 year ago

SocialFi's imitations have emerged repeatedly, overshadowing the entire chain game at ChinaJoy. During this time, I have been contemplating the potential paths for future Web3 Games, and the most promising one is ZKP (Zero-Knowledge Proof) + Fully On-Chain Games.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

Since early August, I have been experiencing @Zypher_Games' zBingo, a fully on-chain game based on ZKP (Zero-Knowledge Proof). Currently, 2048 and Texas Hold'em are still under development, which is a significant turning point for fair competition.

To cut to the chase: ZKP will definitely become an important infrastructure in ① strategy games with random attributes and ② fully on-chain games with incomplete information disclosure.

When discussing ZKP+Fully On-Chain games, we can divide them into two categories:

① Fully on-chain games with incomplete information disclosure;

② Competitive games with random attributes.

For example, Dark Forest, a strategy game named after "The Dark Forest" in the novel "The Three-Body Problem," is a fully on-chain game that emphasizes randomness. It focuses on Fully On-Chain Games, MMORTS (Massively Multiplayer Online Real-Time Strategy Games), and fog of war.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

The fog of war represents the unknown overall situation. As a game with hidden information, it requires the calculation of secret information verification, and there are many points based on ZK design.

For fully on-chain games, the most significant feature is that all data and operations are stored on the chain, completely existing on a transparent data layer. This raises a major issue of privacy protection—when I attack your city, the opponent doesn't need to send scouts to monitor; they only need to monitor the on-chain data to know all my information, right?

Games like Texas Hold'em, Mahjong, Bingo, and Poker, which have strategic card games with random number attributes, require even more. The first thing to do is to fully integrate them into the chain and empower them with ZKP. Otherwise, how can I trust the dealer's integrity?

Perhaps while playing certain competitive games, players may suddenly realize, after reaching a certain level, that the randomly dropped equipment and health potions are becoming scarce. Why are the drawn cards getting worse? This is probably not just a simple matter of luck. In the future, project parties (dealers) will probably need to prove that they have not engaged in any black box operations.

For a competitive game with randomness, direct offline random distribution by hand or machine is often associated with the saying "the house always wins." This not only sets the win rate of the game mechanism but also involves certain insider operations.

Online credibility is even worse. As a non-open-source competitive app, we can almost be certain that the project party will adjust the mechanism and probability according to different matches and rankings.

Therefore, for online competitive games with random distribution, if the project party does not build ZKP (Zero-Knowledge Proof) technology as an important infrastructure for self-verification, it will probably be difficult to convince people.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

zkSNARK—The Key to Information Concealment

Zero-Knowledge Proof technology has three characteristics: completeness, correctness, and zero-knowledge, meaning it proves the conclusion without revealing any details. Its technical origin can be seen as simple, as in the context of homomorphic encryption, the difficulty of verification is much lower than the difficulty of proof generation.

In the structure of zero-knowledge proof, there are two roles: the "prover" and the "verifier." The prover creates the proof based on the knowledge input into the system, while the verifier has the ability to confirm that the prover has accurately evaluated the calculation without knowing the input or recalculating the situation.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

ZKP is by no means a foreign concept. For example, Zk-Rollup, as an effective proof mechanism, has proposed a new solution for Ethereum's scalability. Previously, while everyone was busy with airdrops and interacting with zkSync, its core uses ZK to bundle multiple operations into one proof and completes most of the calculations off-chain.

Or in the case of zkSNARK, where SNARK stands for "Succinct Non-Interactive Arguments of Knowledge," which means that the proof in zkSNARK is only a few hundred bytes, making it easy for the verifier to quickly check if the proof is correct, and the non-interactive proof means that the verifier does not need to question the statements submitted by the prover.

As we mentioned earlier, for a fully on-chain game, all data and operations are stored on the chain, making it difficult to ensure privacy. For example, random coordinate generation, player spawn points, remaining hand cards, and each card played can all be queried through on-chain data.

With the support of zkSNARK technology, players can maintain their privacy status while publicly submitting verifiable valid actions. This way, participants no longer need to directly submit specific operational information about their on-chain behavior to the chain, but only need to submit a commitment to the operation and a hash of the valid zero-knowledge proof, without worrying about others knowing their hand.

For fully on-chain games, what are the privacy requirements for incomplete information? Games like chess and Chinese chess, which do not require privacy and only need strategic gameplay, do not need the technical enhancement of ZKP.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

However, for Mahjong, card games, and incomplete information strategy games—especially in GameFi and competitive scenarios—care must be taken.

So, it is still necessary for the following three types of games:

① Fully on-chain games with partial information hiding requirements

② Card games on the chain that require shuffling and drawing

③ Full chain asynchronous games

To elaborate, asynchronous games refer to the implementation of non-real-time player game interaction mechanisms.

Example: Mechanism of Zypher Games' Fully On-Chain ZK+ Games

For these three types of games, let's take Zypher Games as an example. They have designed three game mechanisms based on their self-developed zk-Game SDK to illustrate how to achieve the asymmetric on-chain information required for fully on-chain game development.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

For fully on-chain asynchronous games, we can directly refer to Dark Forest. Zypher Games has also introduced a universal Zero-Knowledge Game Engine (UZKGE) to assist in the development of fully on-chain card games, such as the provability of calculations, scalability, concurrency, and on-chain data/information asymmetry.

zBingo: Fully on-chain game with partial information hiding requirements

Bingo seems to be more popular in the West, so I spent a long time researching 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 of course, this generation is also based on ZK implementation. The gameplay is quite simple:

① At the beginning, you will receive a 5x5 grid card filled with random numbers from 1 to 36. The specific layout of this grid card is randomly generated, and only you know it.

② After the matching is completed, players take turns choosing numbers on their grid card. The selected number is announced and marked for any player with that number on their grid card.

③ The first player to complete two lines (horizontal, vertical, or diagonal) wins the round.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

In fact, the gameplay is 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 freely generate a grid card, but after this encryption is completed, it cannot be changed;

③ Submitting the encrypted grid card and entering the matching process, this is the first Gas fee expenditure;

④ Matchmaking, to match you with your opponent, this is the second Gas fee expenditure;

⑤ Next, you have to pay gas for every step, for each card revealed, the fee must be paid;

⑥ End, upload proof, and perform the If operation judgment. The winner can receive 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 game is about 2.4 RMB.

In fact, the gas for playing this kind of casual game is not low, mainly because every step of the fully on-chain game requires gas, so I am looking forward to lower costs and faster operations after the upgrade to KanKun.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

zACE: Fully on-chain card game requiring shuffling and drawing

Finally, let's discuss the design differences in the mechanism of fully on-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.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

In practice, the SDK achieves high-performance, low-cost decentralized shuffling through optimized wasm and pre-compiled 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 can be verified for randomness through encryption. Many L1 blockchains, including Algorand, Cardano, Internet Computer, and Polkadot, use VRF in their consensus mechanisms to randomly select block-producing nodes.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

However, due to the highly deterministic nature 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 individuals responsible for verification can choose to abandon blocks that are unfavorable to them and regenerate random numbers until it is favorable to them. This is also why the importance of ZKP+full chainization.

Z2048: Fully on-chain 2048

The developers of the Zypher Games platform are preparing to launch a game called "Z2048," which is a fully on-chain game adapted from the popular casual sliding number game 2048.

Gameplay: In a 4x4 grid, there are initially two random numbers 2 on the 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. A new 2 or 4 is added to a random position on the board after each move.

When the player's final number reaches 2048, they 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 ends.

Platform NFTs can increase game time and resurrection rights. In this game, ZKP is used to achieve scalability.

ZKP-Proved: Here, the smart contract does not require every step to be submitted to the chain—this would require the player 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 results are both unchangeable 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.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

UZKGE: Zero-Knowledge Game Engine, with a highly optimized Plonk library, is a fast-scaling zero-knowledge (ZK) circuit library supplement carefully crafted to meet the diverse needs of game developers.

ZKP+Fully On-Chain Game: The Cornerstone of Fair Competition

These circuits facilitate complex calculations, ensure the integrity of game mechanisms, and protect player privacy. These encryption technologies enable game developers to verify critical game data without revealing potential details.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

ad
Gate: 注册赢取$10000+礼包
Ad
Share To
APP

X

Telegram

Facebook

Reddit

CopyLink