When the WAX Blockchain launches on June 30, 2019, dApp developers will have access to a variety of new features. Today we would like to share details about one of our forthcoming WAX Blockchain features, the WAX RNG (random number generator) Native Blockchain Service.

What is an RNG?

A random number generator is an algorithm that generates values in an unpredictable manner. Developers use RNGs when they need to introduce random outcomes in their dApps, such as the generation of a digital collectible or non-fungible token (NFT). Yet the current method for integrating random values into smart contracts has numerous process flaws. These flaws create potential vectors for unfair, or non-random results, and undermine customer’s confidence in dApps.

Problems with RNGs today:

There are three main problems that developers experience when trying to generate and ingest random values into their dApps:

- There are no blockchain-native RNG services. Developers must build their own, replicating work that would be better directed towards other areas of their dApp, like designs and features that improve the customer experience.

- Because most dApp developers are not RNG process experts, most dApp-specific RNG services have design weaknesses.

- dApp customers have difficulty determining whether a dApp's RNG service is actually generating a random result. This diminishes customer confidence.

How the WAX RNG Native Blockchain Service solves these problems:

The WAX RNG Native Blockchain Service:

- is open source and is a blockchain-native service that developers can easily integrate into their dApps.

- is based on the Signidice algorithm and RSA verification. Signidice was chosen for its excellent randomization and non-gameablity characteristics, in addition to yielding a cleaner workflow for dApp developers and being provably fair. RSA verification ensures uniqueness of the signature and removes the ability for the results to be manipulated (if any other type of signing algorithm were used, it would allow many valid signatures for the same signing_value which could result in manipulation).

- can easily be established as provably fair. The self-verifying WAX RNG Native Blockchain Service confirms that the RSA signature that comes back from the WAX RNG oracle is valid and authentic before being utilized by the dApp. When dApp customers can easily establish fairness, they have a higher degree of confidence in using the dApp.

How easy it is to use? See below.

How the WAX RNG Native Blockchain Service works:

In this scenario, when a customer decides to play a video game dApp on the WAX Blockchain that incorporates a random outcome, the video game dApp prompts the customer to submit a seed value. The customer’s seed value will be used to generate a random value that will be utilized in the customer’s game as follows:

Flow Action The customer selects his seed value and submits it to the dApp.





The customer provides a 64-bit random number (i.e., signing_value). The WAX RNG Native Blockchain Service publishes rsa_public_key. The dApp’s smart contract requests a random value from the WAX RNG Native Blockchain Service based off the seed value that the customer provided. dApps will call requestrand with signing_value and a tracking identifier (i.e., assoc_id). The WAX RNG oracle listens to this request and responds by signing it with an RSA private key and thereby generating only one possible random value, and sending it back to the WAX RNG Native Blockchain Service. The WAX RNG oracle signs signing_value (generating the random_value) with the rsa_private_key corresponding to rsa_public_key. The WAX RNG Native Blockchain Service provides the random value to the dApp smart contract . The dApp smart contract uses the random value to trigger an outcome based on the dApp’s specific logic The WAX RNG Native Blockchain Service expects the callback function receiverand to be available on the dApp developer’s contract. This function involves implementing the dApp’s randomization logic (e.g., roll of a dice), which is determined by using signing_value as the random value for those calculations. The WAX RNG oracle will call receiverand with random_value and the assoc_id.

Note: The WAX RNG Native Blockchain Service is provably fair, so customers can verify the random value generated (see “WAX RNG Native Blockchain Service simplified developer flow” below for details).





Below is a sequence diagram of the scenario described above. It shows the interactions between the customer, the dApp, the WAX RNG Native Blockchain Service and the WAX RNG oracle:

Click to enlarge

Sample implementation of a smart contract calling the WAX RNG:

Click for Pastebin

WAX RNG Native Blockchain Service simplified developer flow:

The diagram below shows the difference in the number of actions required when using a dApp-specific RNG (left) versus the WAX RNG Native Blockchain Service (right). The WAX RNG Native Blockchain Service simplifies developer flow by reducing the number of transactions and eliminates the need for seed values to be hashed. The result is a transaction time of just 1 second.

As shown in the diagram above, a dApp customer can verify that his seed value - sent to the WAX RNG Native Blockchain Service - is the same seed value used by the WAX RNG oracle to generate a random value. This is because every value the WAX RNG Native Blockchain Service receives and every value the WAX RNG oracle generates is recorded on the WAX Blockchain, making it fully transparent for dApp customers and developers. The WAX Blockchain permanently stores an auditable multi-index table containing:

- Every WAX RNG signing value

- Every WAX RNG oracle signing result

As stated previously, you can verify that these results are correct by performing an RSA signature verification against the signing values and signing results.



Two high volume dApps are already using the WAX RNG Native Blockchain Service:

Two high volume dApps, VGO and vIRL, have been using the WAX RNG Native Blockchain Service for many months on the beta WAX Blockchain. Both of these dApps are using the WAX RNG Native Blockchain Service to create thousands of randomly generated NFTs every day. You can learn more about VGO and vIRL here:

- https://vgo.gg/

- https://govirl.io/



Conclusion:

The open source WAX RNG Native Blockchain Service provides a simple way for WAX Blockchain-based dApps to acquire random values. Given the number of dApps incorporating RNGs, the WAX RNG Native Blockchain Service is a huge time saver for developers and simultaneously gives WAX Blockchain dApp customers more confidence in the results of random outcomes. We invite dApp developers to begin experimenting with our easy to integrate and provably fair WAX RNG Native Blockchain Service when it is open sourced at mainnet launch June 30, 2019. Sign up for our newsletter at wax.io to get notified of future updates and releases.

---

Let us know what you think by joining the WAX community:

Twitter

Telegram

Reddit