Cocos-BCX Provides Three Solutions for Random Processes|To Reduce the Cost of Player Trust So That the Game Environment Becomes More Fair
Cocos-BCX defines the four development stages of blockchain games in the white paper:
1. Use homogeneous assets as the settlement of the game “coin”.
2. Free exchange of game “coins” and props.
3. The key rules of the game run on the chain.
4. The game runs on the chain as a whole.
At present, most blockchain games are in the first stage, and a few are in the second stage. Some games based on Cocos-BCX, such as Cocos Shooting games, have entered the third stage. Shooting uses the stochastic process of endogenous feasible trust on the Cocos-BCX chain, which reduces the developer’s development cost and greatly reduces the player’s trust cost. Through the strategy of “interaction on the data chain and operation outside the game chain”, that is, “key rules on the chain”, the game environment becomes more fair.
1. Exogenous stochastic vs. Endogenous random
A stochastic process is the entire set of random variables that depend on a parameter, which is usually time.
Exogenous stochastic: refers to the uncertain factors of the random process, which occur outside the blockchain system. External sources are random, and there is no guarantee that the generation process of random factors can be trusted by the chain system.
Endogenous random: refers to the uncertain factors of the random process, which occur within the blockchain system. The endogenous randomness can ensure that the generation process of random factors is trusted by the chain system.
2. How does a blockchain system ensure that the random process and its results are credible?
1. The node that completes the execution of the random process cannot know the scene and object where this random information is used, so as to avoid this part of the information being used for cheating;
2. The stochastic process should not be publicly disclosed on the chain before the end of the business behavior, so as to avoid losing fairness due to publicity. For example, in a round of landlords in progress, the card information in the hands of players should not be published on the chain;
3. The endogenous stochastic process should be resistant to BP / developer cheating.
At present, Cocos-BCX has successfully implemented a credible random process in the chain, and calls the random process as an interface for contract developers to call.
Developers only need to call the random function in the contract to get internal random data. Quite convenient! Not only greatly saves development time, but also greatly reduces the cost of trust for players.
3. Three Stochastic Process Solutions
To achieve endogenous randomness, that is, a random process on the chain, a key problem needs to be solved: the smart contract describing the rules of the random process on the chain needs to be public, and the noise of the nodes is required to participate in the input when the contract is running. (Noise here should refer to a sequence of random numbers). However, the noise of different nodes cannot be consistent. In short, other nodes cannot verify whether the results of this random process are correct by running the smart contract again. In the end, consensus cannot be completed.
To solve this problem, Cocos-BCX proposes three feasible solutions:
A: Random Data Pool
One or several random data pools are maintained in the dynamic data area of the blockchain. The block producer wraps the result of the random process in the encrypted data segment of the block, and the code of the encryption process is not public. All nodes will have the same set of random data pools. The data structure of the random data pool is in the form of a pipeline, with read-side and write-side encapsulation. Only the read-write side that meets the rules is allowed to access. It has the characteristics of FIFO.
Scheme A Features:
1. Any access (read, write) behavior will cause the random data pool to change and cannot be recovered;
2. The behavior of writing random data is completed by the dynamic encryption function library, and the function library is closed source and not public;
3. The producer of random data cannot know where the results of this random process will be placed in the random data pool, and who will use this random process;
Scheme A is suitable for scenarios where the transaction processing order is consistent, for example, in the RPG (Role-playing game, role-playing game), a player opens a map treasure chest to obtain random items.
Through the delegation mechanism, some transactions can be delegated to a trusted node cluster to complete processing. In the node cluster, the currently online trusted nodes are randomly assigned to execute transactions. After the trusted nodes finish processing, the results of the random process are recorded, and the notification or polling mechanism is used to let the client obtain the results.
Scheme B is based on the chain transaction delegation mechanism, and the changes to the chain are less than scheme A. However, to ensure the feasibility of the solution, the following requirements must be met:
1. The trustee shall verify its credible execution environment to ensure its credibility;
2. When the trustee runs a random process and publishes the results, it should use an encryption function library that also has security;
3. The transmission of encrypted data needs to prove the trustee’s identity through “zero-knowledge proof” or other reliable certification schemes, and can be identified by the client to ensure that the data obtained by the client is not forged by a third party.
Scheme B is suitable for an application scenario in which a transaction has multiple parties but only requires the same random result, such as the shuffle order of each game in a board game.
The current block producer receives a random transaction, generates a random result through a random function, and encrypts the random process and the random result into the block data through an encryption function, and sends it to the entire network in a package. The other ordinary nodes accept the random result and apply it to complete the consensus of random transactions. Scheme C is currently complete.
Scheme C applies to: lottery scenes in the game, such as rolling a dice to generate a random result, etc.
4 . Cocos Shooting
Cocos Shooting by Orion Group is a shooting game. Players get COCOS rewards by destroying enemy aircraft. In addition, there are operations such as item lottery and item enhancement. All parts of the game involving probability are completed by the endogenous random of the internal source of the Coccos-BCX smart contract to prevent cheating, which fully reflects the fairness of the game in the chain.
Cocos-BCX Chief Technical Advisor Kevin once stated that key parts of different games are different, such as maps and monsters in SLG (Simulation Game) games, treasure chests, dealers in board games, and card games. Card operation. Putting the game’s core gameplay on the chain first will allow players to truly feel the change (more fair) that the blockchain brings to the game.
The implementation of Cocos-BCX’s endogenous trusted random process allows blockchain games to take a big step forward.