Editor’s note: This article from the Babbitt information (ID:bitcoin8btc), author: Huang Lianjin, the famous expert block chain, poly nuclear chain chief scientist, American DistributedApps CEO, Chinese Electronic Association Expert Committee, blockchain NULS consultant; also, Java software engineer, Cryptotech-Writer NULS, Core Team member, authorized reprint by Odaily daily planet.
In people’s lives, many scenes need to use random numbers, such as welfare lottery, license-plate lottery, public housing allocation etc.. The development of the Internet, let people on the use of random numbers to rely more and more on the center of the system, but the vast majority of the center of the system, random number generation is pseudo random number, and there is the risk of cheating.
There the blockchain, let people see the random number generation may be more fair. The random number for the block chain itself also plays a very important role in the end, the random number in the block chain in which scenarios? Block chain is how to generate a random number of more reliable?
Application of random number in the block in the chain
Have people know the private key encryption currency importance, who has your private key, you will have the encryption of assets. The private key in Chengdu need to rely on the random number, so can guarantee a random number of unpredictable and crack, relations with the encryption security of assets.
The use of bitcoin private key is a 256 bit random number generated by SHA-256, 0~2 – -1 is the range of the random number. 256 times 2 is similar to 77 times 10, this is a range of very large number, with the existing computing power, to brute force, almost impossible.
Not brute force, but if the random number generator to generate random numbers can be manipulated, random number generation can be predicted, that your private key can be decrypted and encrypted security of assets would not be protected.
Application of guessing
In the quiz application, require the use of random numbers, random to ensure the fairness, to avoid human intervention, affect the results.
In the center of the environment, users need to participate in the quiz quiz to submit orders, according to the rules system to collect user information, and then generate the quiz results. In the whole process, calculate the client will not participate in the quiz results, quiz results is essentially a random number generated by the system. When there is a great temptation, the system may allow yourself to benefit from cheating.
In the decentralized environment, not only the center of generation can let all nodes participate in random number,
Fairness can ensure the effective random number. But in the decentralized environment, hackers can be more convenient to random attack, benefit from. So far, the safety of the blockchain random number is still a need to break through the technical problems.
In August 2018, the hot Fomo3D game, will be used by hackers the random number of vulnerabilities, get a huge interest in the game. After Fomo3D, many popular DAPP EOS, especially the quiz games, such as EOS.WIN, EOSDice and so on, also has defects generated random number hacking.
POS consensus mechanism
Block chain is a distributed billing technology to the center, to the center of the environment, to achieve the correct accounting, random selected accounting, is the key. Because only in the random condition, in order to ensure the entry right allocation fair, reasonable distribution of mining reward.
The consensus on the mechanism of POW, the competition is very difficult, calculating a hash value, to determine who will account for random. The consensus on the mechanism of POS, is required by the random number, random election of a node to account.
Most of the POS protocols will be based on the number of holders of tokens, a group of miners and the verifier elected jointly completed verification of the chain and block trading. In order to select random miners and verifier, ensure fair allocation of rewards, random number generator algorithm must be integrated into some fair and impartial. In so many POS consensus mechanism, a random number is one of the key technology.
True random number and random number
The random number is divided into true random number and pseudo random number. True random number sequence is completely unpredictable, only exists in the real physical world, such as radioactive decay, electronic equipment noise, cosmic ray trigger time, we can collect these data, obtain true random number list. Pseudo random number is obtained by random count column (commonly known as random seed), using a random number algorithm to. As long as the random number seed, you can get the same pseudo random number list.
So the true random number only exists in the real physical world, the vast majority of computer random number are pseudo random number. To ensure the safety of the pseudo random number, we need random seed and secure random number generator effectively.
Random number generation block chain
Block chain is a system, to the center of the theory, random number generation than the center of the system will be more fair, but in to the center of the environment, if there is a huge interest, vulnerable to hackers, so in order to ensure the safety of the block chain of random numbers, random number generation mechanism was born with various.
VRF (verifiable random function)
VRF (Verifiable Random Function, verifiable random function) is a kind of verifiable random number
Generation. At present is mainly based on the block chain project POS consensus algorithm in use, including Algorand, Cardano.
In Algorand, Cardano, VRF is the key for generating random number. VRF can be based on an arbitrary input and output a random number. In the VRF in a specially designed non interactive zero knowledge proof, can be used to verify the correctness of the random number, and a random number is generated by a node.
VRF mainly includes four aspects:
The private key to generate
Random number generation output
The calculation of zero knowledge proof
Verify the random number of output
The node generates a random number will be its own private key, as part of a random number generator input, and it is shown that the local output random number and zero knowledge. The public key, input and output nodes can use other nodes to generate random numbers, random number generation and verification of the identity of the true and false.
After a random number, you need to use the random number generated in block node selection. The easiest way is to set up a recognized the critical value of M in the whole network, assuming a R random number generation is greater than the critical value of M, the system allows the nodes involved in the next step of a task. But this scheme is no way to prevent witch attacks, so now most of the VRF program will draw the votes allocation based on equity, then draw design algorithm, complete the following consensus process.
Randao block chain technology based on open source, provide to the center, random number generation service card fair. The goal of Randao is to meet the basic characteristics of random number generation uncontrollable and unpredictable at the same time, the individual can participate in the generation of random numbers, random number with guaranteed participation, the characteristics of block chain transparent and irreversible, ensure the fairness of.
Randao uses Commit Reveal and BLS. Commit Reveal, the main drawback is the random number generation speed. In the etheric Fang, from the receipt of the random number generation request, to generate random numbers, at least 10 or more of the time, the current time in 3 minutes or more; because of the need to repeatedly send the transaction participants to submit data to the production and use of high cost. But the advantage of this scheme is that, the participation threshold is almost zero, the generation process of anyone can join a random number, have certain advantages in preventing collusion and permit fair.
BLS signature scheme is a supplement to the Commit Reveal, because the generation process in the chain, fast response speed, usually require only a block of time will be able to generate random number; random number generation consumer initiated requests, the producers to write random numbers in the next block, generation and call only need to send each transaction you can complete the random number, the cost of production and use are very low, suitable for high frequency, while the anti collusion demanding scenes.
The threshold signature scheme (Threshold Signature Scheme)
Dfinity is a chain of public projects, the goal is to become the Internet computer, software and services in the public cloud operation. In Dfinity, the random number is the core of the normal operation of the entire consensus mechanism, the threshold signature mechanism combines VRF and BLS signature mechanism is an effective way to generate random numbers.
Threshold signature mechanism is mainly composed of three parts: input, output, threshold mechanism. The input is a member of a group of private key, the output is a random number. The threshold mechanism can guarantee is that as long as the number of receive input from the member exceeds the set value, you can get a random number to determine the number of input, but are less than the set value, no one can predict the output of the random number is the number of. The process of using VRF output of the random number in the BLS signature scheme using threshold mechanism.
Threshold signature mechanism combined with VRF and BLS, VRF to generate random numbers with verification, BLS signature mechanism makes the signature process, no node can predict in advance the signature results, achieving a random number is not in control, and it is difficult to collusion, is a good random number generation mechanism.
NULSRNG is the open source community NULS project, according to the POC (Proof of Credit) consensus algorithm, specifically for the random number seed generation mechanism of DAPP design.
NULSRNG method is presented to generate two random seed mechanism based on POC agreement. Each node generates a random seed in a block at the same time, and the random seed is encrypted, the generated ciphertext is contained in the area size, 256 random seed acquisition and generate the node when the last block of plaintext. The man in the binding region of plaintext and ciphertext, random number generation of seeds can be verified to ensure that no tampering.
The underlying NULSRNG implementation based on consensus, participation by all common nodes, this way increases the difficulty of the seed node collusion, the ciphertext and the two section expressly presented in a way that can realize the authentication and tamper proof of seeds.
NULS on the development of the DAPP, you can directly use the underlying interface provides access random seeds, then the random algorithm, random number generation needs, not only can improve the safety of the random number, and use can be flexible and convenient.
In 1, block chain, random number has a scene very much, with the continuous development of block chain technology and improvement of application will be a random number of people on the block chain increasing;
2, in the blockchain field, there are many different random number generation mechanism, they all have their own characteristics;
3, realize the importance of the random number, more and more technical team and the project started, the random number generation mechanism better, the future will have more chain block random number generation mechanism generated.
“Randao: Verifiable Random Number Generation”;
“Veri able Functions” Silvio Random Micali, Michael Rabiny, Salil Vadhanz;
“DFINITY Technology Overview Series Consensus System” Timo Hanke, Mahnush Movahedi, Dominic Williams.