The mechanism of Ultrain’s Random Number Generator

ULTRAIN
ULTRAIN
Published in
4 min readJan 9, 2019
Ultrain Chief Cryptologist, Husen Wang

As we all know, the core feature of blockchain technology is that any data stored on blockchain is non-malleable, and any state transition is transparent to everyone. Based on these features, blockchain technology can help solve many controversial problems, one of which is fairness.

Fairness means that everyone is treated fairly, which means that all transactions are selected and executed with equal probability, with the same opportunity to participate in the competition and treated the same way. In reality, numerous businesses require fariness in the core, such as gaming, jurors and military conscription. In tradition, the process is vague due to technical limitations, which bring about controversies. For example, in League of Ledges, the probability of critical attack is crucial to the game, but the underlying mechanism is not transparent and unproven.

On December 5, 2016, the Ministry of Culture of People’s Republic of China released the Notice on Regulating Online Game Operation and Strengthening Concurrent and ExPost Supervision that ”game operators shall timely and truthfully publicize the information regarding the Random Events including names, functions, content and quantity of the virtual items 3 or other similar services offered in the Random Events as well as the probability of winning and the results”. However, there is no evidence for complying the rule as to online game vendors.

We use blockchain to solve this problem by the following way

1, the random number can be generated and verified with free particiaption

2, the game logic such as card shuffling service can be made transparent with smart contract

In this way, everybody can audit the execution and result at any time, with impossible interference from game vendors, thanks to the non-malleability of blockchain technology.

For the first one, there are several existing solutions:

1, centralized random source

Thermal noise and clock drift in electronic circuits, mutually exclusive events in Photons, Fluctuations in vacuum energy, etc. However, these random numbers are required to be provided by the people who samples such noice and impossible to verify, thus not appropriate for public use.

2, PoW blockchain Block header

In order to solve the difficult problem in PoW blockchains, miners need to guess a random number to generate required blockhash such as a pre-established number of zeros. Since the miner invests considerable resource into the mining process, the probability for giving up is small. However the security level is co-related with the difficulty of such PoW, for weak PoW such as IOTA, the manipulation of block header is inevitable. Besides, considering the fork probability, the confirmation time for such random number is usually quite long.

3, DPoS Block header

Unfairness and collusion is hard to prevent in DPoS, since the block proposers are pre-selected and limited in numbers. The block proposer has motivation to manipulate the transactions in a block to generate desired block header. They can even produce necessary transaction by themselves. Even for commit-reveal scheme, by selecting the revealing transactions, the final random number can be manipulated.

There are some misused random number in EOS games.

https://github.com/generEOS/eosio.random/blob/master/random.cpp

4, users’ secrets

If different users hold secrets against each other, it would be possible to generate random numbers based on combined secrets. This idea is similar to Diffie-Hellman Key exchange, which generates shared secret key based on committed random number.

There is a commit-reveal scheme in Blockchain too. However, the two-phase scheme brings too much latency (nearly 6 block time without considering fork). Besides, free choice of committed value may cause potential risk to final random number in case of collusion.

The nature way to use random number is actually users’ secret keys. The public keys are committed values. Such secret is confidential to each user, otherwise the money in the account would not be safe. By deriving random number from such secret and combine them together, the randomness can be guaranteed.

In Ultrain, based on RPoS consensus algorithm, we designed our random number generator as a primitive, with the following advantages:

- Safeness, the block proposer in RpoS is randomly selected, which guarantee the fairness, avoiding manipulations by proposers, compared with DpoS and blockchains with weak PoW such as IOTA/Litecoin.

- Randomness, combing randomness from secret keys and avoid manipulation by using Verifiable Random Function. Advanced shifting and pool controlling mechanism to reduce manipulation.

- Fast generation, low communication & computation overhead, avoiding communiation complexity in Dfinity.

- Fast confirmation, RPoS uses BFT based algorithm without forking, avoid waiting time in Bitcoin/Ethereum/Dfinity.

What’s more, Ultrain provides extra security enhanced layer in smart contract level for specific business solutions.

Demos are available right now. Any team with interests can get in touch with us through Ultrain.io.

--

--