What are random results in Blockchain and Web 3?

As economic, social, and cultural interactions have increased in recent decades and the Internet space, the demand for the randomness and unpredictability of the natural world has also increased. The term “random” means the absence of a pattern or the predictability of a sequence. The importance of random results in Blockchain and Web 3 is more significant than in other digital domains. Of course, establishing robust security mechanisms and an impartial and reliable decision-making process requires unpredictable results. Join us as we explore the concept of randomness, its types, and the challenges of randomness in blockchain and the Web 3 ecosystem.


An introduction to random results

A random number is a number that is randomly selected from a specific distribution; Therefore, choosing a large set of those numbers reproduces the underlying distribution. It is almost always necessary for such results to be independent so that there is no correlation between consecutive numbers.
Random results have been problematic since the dawn of computers. You might think that using a random function in your favorite programming language would generate a valid random number, but these methods are scientifically called pseudo-random generators. There have been cases where some highly random programs have shown a deterministic nature and contain easily recognizable patterns.
With smart contracts and blockchain, the problem of random results goes even further. If your project doesn’t rely heavily on random numbers, you can mimic random numbers on the blockchain by hashing some unique data. Still, if you sell NFTs and your product attracts significant attention and funding from the community, you will be a target for hackers.

The beginning of random results in the digital world
Humanity has long used luck. From throwing dice or reading maps to know your future to other ritual uses. However, it was not discussed until the Middle Ages (when randomness was formally studied).
One of the main applications of randomness is related to the study of Pi and its random and infinite form of decimal numbers. Mathematicians interested in this fact began investigating how this phenomenon might be replicated in other spaces.
However, with the emergence of probability’s mathematical and algorithmic foundations, randomness is considered essential for studying physics, especially quantum physics. In computing, using random numbers to create algorithms, chips, and encryption systems is one of the basic technologies in creating the digital world and its security.

What is the idea of Web 3?
The original idea of Web 3 was presented in 2014 by Gavin Wood, co-founder of Ethereum and founder of Polkadot. In 2021, much attention was paid to this concept, and the movement towards it became more serious. Web 3 can be considered a solution to the problems of the second generation of the Web. Limited opportunities to make money, control of people’s information by big companies, and general concentration of resources are among the problems the third-generation web emerged to solve.
The third generation of the web is a platform that, in addition to the features of the previous generations, has an additional asset feature. This means that users can access different content, create new content, and have complete control over what they can create and influence in that space.

Web features 3
To better understand the idea of Web 3, we mention its features case by case:
Decentralization: Instead of centralized entities owning and controlling the Internet, ownership is distributed between creators and users.

  • Equal opportunities: Everyone has equal opportunities to participate in the Internet and the Web, and no one is excluded.
  • Native payments: Every active project in Web 3 should have its economic system based on sending and receiving online and not relying on old infrastructure.
  • Trust without a third party: Members and components of this space cooperate based on economic mechanisms and reward and punishment systems without needing a supervisory and intermediary body.

Randomness in Blockchain
Blockchain technology and its randomness are evolving. Knowing that computers cannot represent true random number generators (chaos and order cannot co-exist in an algorithm), one such development of randomness in the blockchain is to use the same blockchain to use the generation of “random results” so that They are used in different cases.
It is almost impossible for computers to represent genuinely random numbers. The developer can create an algorithm to generate random results, But this generator follows fixed (algorithmic) “parameters” that can be finally checked with mathematical and probabilistic methods. These random number generation algorithms (or pseudo-random numbers) can be analyzed and broken, leading to generation of random numbers.
With this in mind, many blockchain developers are trying to convert the data within these networks into random number generators that can be used in other applications. But how is this possible? In the following, we introduce tools to achieve this goal.

Hash block
One of the tools to achieve this goal is block hash, which uses the hash of blocks, transactions, or a combination of them as a source of randomness. Since the soup is definitive, everyone comes to the same conclusion. Once added to the blockchain, a block remains there forever, allowing everyone to verify the correctness of the generated numbers.
However, this method has a severe security problem; Miners can manipulate hashes. While this seems like a small problem, it is unacceptable in a secure random result generator. For this reason, this system is used very limited.

Oracle
Using oracles is another way to generate random results on the blockchain for third-party applications. Projects like Provable, Uniswap TWAP, or Chainlink VRF are examples of this system.
This system is easy to operate. After these systems collect data from external sources, they will process it in their network and generate a massive collection of random data that the system users can use. The best part of this system is its decentralization. Also, this system uses different random sources in parallel. In addition, these are accompanied by a cryptographic test to verify randomly generated data.
The importance of random results on the Web 3
Many people may not understand the importance of random results in blockchain and Web 3, Especially when determining the outcome of blockchain games, NFT projects, or digital art. Web 3 applications require a secure random source to produce fair and unpredictable results. For example, features such as identifying the location of assets in metaverse games, adding diversity to the generative art algorithm, awarding prizes to winners, validating event tickets, or periodically determining participants and autonomous organizations (DAOs) for a specific governance role all require a secure source of randomness.

Because these systems can significantly simulate real-world value, the exploitable results of suboptimal stochastic solutions can create information asymmetry and unfair advantage to a subset of participants. These scenarios can often create negative feedback that leads to power imbalances in interactions and eventually leads to the complete failure of economic and game theory mechanisms designed to enable economic activity and social harmony.
Accessing a random resource that is an unpredictable and auditable resource for all participants is not easy. However, the desire for transparency in the Web3 industry has given way to many applications and protocols that differ from their Web2 counterparts. Accessing a fair and unbiased random source in a secure and verifiable manner opens up many new use cases in blockchain gaming, NFT, decentralized governance, Web3 social media, fundraising and charity, social tokens, and more.

Generate random numbers
We find many patterns and unpredictable outcomes in nature, but are we so sure about the random outcomes of computers? Computers are deterministic devices, and accurate random numbers may not be generated through computer algorithms. Although random events are considered individually unpredictable, the number and frequency of different outcomes in repeated events are predictable. For example, the outcome of each dice roll is unpredictable. However, the probability of the outcomes of more than 100 dice rolls can be calculated with certainty.
Are random results random?
To know whether a random outcome is truly random, we must define a set of rules for a random sequence. These rules are as follows:

  • Unpredictable: The results must be unpredictable.
  • Unbiased: The probability of each outcome must be equal.
  • Verifiable: The result must be independently verifiable.
  • Protection against tampering: The process of generating random results must be secure against any tampering.
  • Irreproducible: It is impossible to reproduce the process of generating random results unless the original sequence is preserved.

A computer can be considered a predictable device. Its components and circuits and a set of defined codes and algorithms make it possible to predict the output of random numbers or sequences generated by the computer under constant conditions. Just as a calculator displays the result of the equation 2+2 as the number 4, a computer must produce a specific output for the same input. Therefore, computers may be unable to generate actual probability conditions and random numbers.
To solve this limitation, Random Number Generators (RNG) use Seed. The seed is the so-called seed or input for calculating the output. Seeds can be produced in different ways; For example, the data of a photo and the time or movement of the user’s mouse can be used as a seed.
However, if the random number generation process is challenging to reproduce, it does not mean that it is technically impossible to reproduce the process. Combining several brutal methods to replicate Seed production yields relatively reliable results. Even assuming the Seed is revealed over time, this method is still reliable. But if a similar mathematical method is used to generate the Seed, the results are not truly random.
Pseudo-random RNGs vs. true RNGs
Generally, random number generators can be divided into two categories. Pseudo random number generator and true random number generator. A pseudorandom number generator uses mathematical algorithms to generate random values, and a true random number generator uses physical tools such as atmospheric noise.
Pseudo random number generator function
Pseudo-random number generators (PRNG) are a set of algorithms that use mathematical formulas to generate a random sequence. This random sequence is an imitation of real random numbers. Because computers are discrete systems, the numbers they generate appear random to human observers. Still, the results may contain recognizable patterns, and extensive statistical analysis will make pattern identification possible.

True random number generators (TRNG) use physical sources such as atmospheric noise, decay of radioactive isotopes, or stationarity in waves to generate random numbers based on natural phenomena. Since the randomness in this method comes from physical phenomena, its randomness is stronger and more unpredictable than computers. In this case, there is a possibility of certainty of information used in real random number generators. If you can get between the real random number generator and the phenomenon being used, you can get the same signal to understand the sequence of numbers exactly.
Although true random number generators can generate random sequences with almost no discernible pattern and a low probability of detection, their high cost makes their use impractical for routine applications. Compared to TRNGs, PRNGs have another advantage called repeatability. By knowing the starting point of the sequence, the observer of the process can reproduce the same sequence of numbers, and in this way, it will be possible to verify the process of generating random numbers. This feature is efficient and useful for third-generation web applications that use randomness.

Why is randomness important in blockchain?

The most important principle of cryptography in blockchain is the security of the process of generating random results. Cryptographic hash functions are an essential element in generating private keys for crypto wallets, making it difficult to guess the private key. Some studies compare the number of possible private key combinations in the SHA-256 hash function of the Bitcoin protocol to the estimated number of atoms in the world.

Randomness in proof-of-work algorithms

Distributed consensus is limited by the number of messages that can be sent in a given period (throughput) and the time it takes to send messages across the network (latency). Therefore, distributed consensus is impractical in a blockchain; Where thousands of distributed participants must agree and each node must send messages to other nodes.

Therefore, a network like Bitcoin uses a proof-of-work (PoW) mechanism to limit the number of message transmissions required for consensus. The proof-of-work algorithm determines which blocks are added to the blockchain as a random resource. Since it is very difficult and complex to solve the computational puzzle of miners and their competitors to add a block to the blockchain, the probability of solving multiple puzzle nodes at the same time will be very low. This limits the number of messages the network needs to reach a consensus.

Randomness in proof-of-stake algorithms

Also, in Proof-of-Stake (PoS) systems, chance is used as a basis for fair and unpredictable distribution of validation responsibility. If a malicious agent can affect the random source of the selection process, it means that it can increase the probability of being selected and compromise the security of the network.

As you know, blockchains are transparent, all inputs and outputs are visible to participants and make randomly generated sequences predictable. For example, some random number generation methods such as block hashes have security flaws that can be easily manipulated. If a miner or validator wants a certain result from a random sequence, the block generator can influence the random sequence generation process by not producing blocks that are not useful to him. Simply put, it can fill the dice until the desired result is achieved.

Off-chain random number generation solutions are not transparent and the user should trust the centralized data providers and not manipulate the results for their benefit. Also, the user has no way to tell the difference between a true random feature and a manipulated random feature. Despite the importance of random results in blockchain and Web 3, both on-chain and off-chain random number generation solutions have their concerns.

Chainlink Verifiable Random Function (Chainlink VRF)

So far, we have explored the importance of random outcomes in blockchain and Web 3. Chainlink VRF is an industry-standard random number generator solution. This solution makes it possible for smart contracts and off-chain systems to access a verifiable random resource using off-chain cryptography and computation.

When a challenge is issued from the predefined private keys of the Oracle nodes and the block data is still anonymous, the VRF combines this information to generate a random number and prove the cryptography. The program will only accept entered random numbers with valid encryption certificates. Cryptography is only proven if the performance is proven to be random and tamper-proof.

Since its launch, Chain Link’s verifiable random number function has processed more than 6.5 million requests for fair and unbiased random numbers. Chainlink VRF currently provides verifiable random numbers to over 3,400 smart contracts on multiple blockchains including Avalanche, Polygon Chain, and Ethereum.

Standard features of Chainlink VRF

The standard features of Chainlink VRF are as follows:

• Unpredictability of random outcomes: No one can predict the random outcomes of Chainlink’s verifiable function. Because the block data is unknown at random request time.

• Fairness and impartiality of the results: The generated random numbers are distributed equally. In other words, the odds of all numbers are equal.

Verifiability of results: Users can verify the integrity of the application by referring to the random inputs of the Chainlink VRF.

• Resistance to process tampering: Oracle, external entities, the development team, or anyone else cannot tamper with the random number generation process. If the VRF process is tampered with, the node cannot generate a valid cryptographic proof and the smart contract will not accept input random numbers.

• Transparency: Since the code is open source, users can verify the randomization process.

Thanks to these unique features, Chainlink’s VRF-based applications can achieve fair and unpredictable results through a tamper-proof random number generator. In this way, interesting experiences and features are possible.

final word

Just as chance has many applications in nature and the world of physics, we also need random results in the digital world and the blockchain space. But the point is, how can we trust random computer results? Random results should be unpredictable, unbiased, provable, anti-manipulation, and unrepeatable. The importance of random results in blockchain and Web 3 is doubled with diverse applications such as blockchain games, NFT projects, decentralized governance in the Dao, Web 3 social media, etc. Randomness is very important in blockchain and Web 3, and the outcomes of games, and leadership roles in self-governing organizations in the Dao are all affected by random outcomes.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *