ZMINE BLOG

English English   ไทย ไทย

How ZMINE generate random numbers from Smart Contract (1)

Share this article

From the launched of ST Reward for rewarding the prizes to ZMN token holders by using the smart contract process to random numbers. The question that arises is, how do you know that the numbers are actually random numbers? So in this article will be talking about the system that ZMINE uses to random numbers.

Random with Computer

First, I must explain that the computer cannot be really random or a so-called True Random. The reason is that when we want to command the computer to do anything. It must be programmed and use “Algorithm” to work. When referring to “Algorithm”, Computational Theory means “Deterministic Algorithm”.

Source;  https://en.wikipedia.org/wiki/Nondeterministic_algorithm

 

Deterministic Algorithm is that we put the input to get the original output, or it may get different output if the “state” of the process is changed (imagine the stack of data that is called Pop Data Top) On the other hand, the Nondeterministic Algorithm can yield different results each time it is processed, even with the same input. The most obvious example is the random one. Each processor produces different results.

The reason why a computer can not perform True Random is that everything that is programmed is either a Deterministic Algorithm or can “Predict” the result if the input is always accurate … when it is shown as “Predict” is not random.

The next question is … how do we call a random function in a program like Math.random () Where do they get the random result? The answer is a random process in the computer is a random artifact. We call it “Pseudo-Random” which we will talk about it in the next section.

Random Number Generator

Once we know that the computer is working, we can always predict the result from the input, so it’s easy to imagine. If we want the results to be unpredictable, we can put the unpredictable input instead.

“Random Output ไม่ได้  ก็ Random Input แทนนั่นเอง”

The hard-to-guess input for this randomness is that we call it “seed.” This seed is both random and predicts work random mode. So if we break the process of the random or Random Number Generator (RNG) from the source of the Seed will be divided into 2 groups.

1. True Random Number Generator: TRNG

TRNG Is a random seed-based randomization process through the source of the entropy.

For instance;

1.1 Richard P. Dunnigan’s patent creates a random number generator from a ping pong ball and attaches it to the computer.

1.2 Using hardware to generate random numbers from physical processes, these devices will have built-in detection of  “noise” in the body, such as noise from the heat or from the light particles. And with the theoretical and statistical evidence that this noise is “random noise”

Source;  https://en.wikipedia.org/wiki/Nondeterministic_algorithm

1.3 Random or random drawing through a credible agency such as a government label or a sports diversion. With the broadcast disclose information to everyone to get to know.

 

1.4 Socialize or use the power of the masses. Help to determine the random value. The disadvantage of this method is, if the number of participants is less, there may well be a result of lobbying. If the number of participants is large enough. It is enough to hold that it is really random. The inherent the use of this random method is RANDAO, is a collaborative effort between several people in the Ethereum Network and assigns an ETH reward to participants.

2. Pseudo Random Number Generator: PRNG

PRNG Is a predictable random process. (But in practice, very difficult predict)

For instance;

2.1 Use Algorithm that provides hard-to-guess results, such as Hash or Output, of the results of the previous processing to the next seed. Such as Middle-square method

Middle-square method

2.2 Various computer systems such as epoch time or Unix timestamp, or the time interval between sending and receiving network packets.

2.3 The use of time and behavior of User Input is difficult to guess, such as moving the mouse. Keyboard or long-time pressing, or sample applications such as Putty Key Generator that creates a Private / Public Key When pressed, it will create the mouse to drag us to generate random numbers.

Putty Key Generator

What are the best random methods?

จากการ Random หลากหลายวิธีที่กล่าวมา ถ้าถามว่าวิธีไหนดีที่สุด คำตอบคือ

From the various methods mentioned above. If you ask what is the best, the answer would be…

 

“There is no best method but there are the most appropriate ones”

 

In choosing which methods to use, the user must determine what is the object will be used, in which applications? Each method has advantages and disadvantages, however. Factors to consider are:

1. Transparency

In the job that needs to be very transparent, such as issuing government labels. You should choose a method that uses a True Random Number Generator rather than a Pseudo Random Number Generator.

2. Quantity

The amount of random requires a lot f data at a time,  such as making a casino online with a lot of players all the time, using external randomness such as raffle or Socialize it may not be appropriated. Because it’s slow and using a millisecond time machine will not produce more than 1,000 results per second.

3. Cost

Each random process is costly. For example, live broadcast raffles. It costs very high (but with transparency and public acceptance), or hardware that even produces True Random results, it has a high cost as well as the risk of equipment that may be damaged or difficult to replace.

Making Pseudo Random from Implementing System Values there will be the cheapest cost. At the same time is often become an agrument because he result is predictable

3. Trust (Third Party)

Using Random method from the ‘Third Party’, such as random.org or oraclize, is another way to get random numbers, which is not too expensive. Nevertheless, we have to trust that the Third Party will make this random genuinely for us.

ZMINE random numbers

From information mentioned above… We should understand that the random process is a matter of not being able to predict (but predictable) The most significantly is to choose the appropriate method for the right job. The ST Rewards number of the ZMINE team has come up and how does it work will be explained in the next article … Part (2)