Verifiable Random Function Launch

Dear KuCoin Community,

We are happy to announce that the Verifiable Random Function (VRF) is officially live on the KCC mainnet and testnet. If you’re a developer and want to quickly integrate VRF in  your application, you can check our documentation.

The KCC VRF is a provably fair and verifiable random number generator (RNG) that enables smart contracts to access random values without compromising security or usability. 

For each request, KCC VRF generates one or more random values and cryptographic proof of how those values were determined. The proof is then published and verified on-chain before any consuming applications can use it. This process ensures that the results cannot be tampered with or manipulated by any single entity, including oracle operators, miners, users, or smart contract developers.


When it comes to blockchain games, NFT projects, or digital art, people may not realize the importance of random numbers. Web3 needs secure sources of random numbers to achieve fair and unpredictable results, such as determining the location of game props in the metaverse; adding variables to generative art algorithms; creating treasure box content; casting NFT; awarding winners; validating event tickets; or periodically electing members for the DAO governance committee. 

Yet, accessing a source of randomness that is tamper-proof, unpredictable, and auditable by all participants is not an easy task, especially when bringing entropy into highly deterministic blockchain networks.

For example, RNG solutions derived from the blockchain itself, such as using block hashes, introduce attack vulnerabilities where blockchain miners/validators can choose to publish a block only when it generates more favorable results for themselves. Essentially, miners/validators have the ability to re-roll the dice to obtain a new source of randomness.

Alternatively, RNG solutions derived from off-chain API providers are opaque and unverifiable, so users have no proof that the randomness was not manipulated. There is no way to tell the difference between true or manipulated randomness, leading to a great reduction in trust. Both solutions have become increasingly concerning as the amount of value being secured by the RNG solution goes up.

KCC Verifiable Random Function (VRF) overcomes these limitations using off-chain oracle computation and on-chain cryptography. KCC VRF works by combining block data that is still unknown when the request is made with the oracle node’s pre-committed private key to generate both a random number and a cryptographic proof. The consuming application will only accept the random number input if it has valid cryptographic proof, and the cryptographic proof can only be generated if the VRF process is tamper-proof.

Thus, KCC VRF provides users with automated and publicly verifiable proof that the randomness supplied is provably fair and was not tampered with or predicted by the oracle, blockchain miners, external entities, or the application’s development team.

Ultimately, the ability to access a fair and unbiased source of randomness in a verifiably secure manner enables blockchain developers to build a whole new set of applications for blockchain gaming, NFTs, lucky draws, marketing campaigns, fan rewards, and fair selection and security processes.

How KCC VRF Works

  1. First, the smart contract application, our dApp, needs to initiate a request to obtain a random number, which is given a contract address, which is called the VRF Coordinator contract.
  2. The KCC VRF off-chain node associated with the VRF Coordinator contract generates (via the elliptic curve digital signature algorithm) a random number, along with a proof.
  3. The KCC VRF off-chain node sends the random number and proof generated above to the VRF Coordinator contract.
  4. Once the VRF Coordinator contract receives the random number and the proof, it verifies the legitimacy of the generated random number by means of the proof.
  5. Once the random number is successfully verified, it is sent back to the user’s smart contract application

Major Benefits of KCC VRF

1. Variable Callback Gas Limit: More Flexibility in the Hands of Developers

KCC VRF  offers users the ability to adjust the callback gas limit when the verifiable randomness is delivered to their smart contract application. This enables consuming contracts to execute a more complex logic in the same transaction that they receive the verifiable randomness.

This parameter can be set to a maximum of 2.5 million gas. This functionality is made possible through the pre-funded subscription model.

2. Configurability: More User Control in Defining Security Parameters

KCC VRF offers users the ability to define how many block confirmations the verifiable randomness must pass after a request random number transaction has been made before it is generated and delivered to an on-chain—ranging from a 3-block minimum to a 200-block maximum across the KCC testnet and mainnet.

A configurable block confirmation parameter offers the development teams the ability to strike their desired balance between security (protection from block re-organizations) and performance (latency from request to response) to match their own application’s specific needs. For more information on how to safely set this parameter, refer to the Security Considerations documentation.

3. More Randomness Per Request: Multiple Random Outputs in a Single Request

KCC VRF gives users a seamless and low-cost way to request multiple random numbers (multi-word) through just a single on-chain transaction. Additionally, the fulfillment of randomness back on-chain is also delivered with a single transaction, further lowering its costs and reduces response latency.

By batching multiple requests and responses into a single transaction, users who need multiple randomized values can achieve significant gas savings.

4. Diversity of Requests: Two Methods to Request Randomness

KCC VRF offers two methods for requesting randomness: (The cost of random number assignment for both methods is currently subsidized by the KCC VRF at no cost.)

  • Subscription: Create a subscription account and fund its balance with WKCS tokens. Users can then connect multiple consuming contracts to the subscription account. When the consuming contracts request randomness, the transaction costs are calculated after the randomness requests are fulfilled, and the subscription balance is deducted accordingly. This method allows you to fund requests for multiple consumer contracts from a single subscription.
  • Direct funding: Consuming contracts can be directly paid with WKCS when they request random values. You must directly fund your consumer contracts and ensure that there are enough WKCS tokens to pay for randomness requests.

5. Unified Billing: Delegate Subscription Balance to Multiple Addresses

KCC VRF allows multiple smart contract addresses (up to 100) to fund their requests for verifiable randomness from a single WKCS subscription balance managed by the subscription owner.

This allows developers who manage multiple smart contracts requiring randomness to simplify fund management and reduce gas costs. By making KCC VRF cheaper and more customizable, developers can begin building more advanced use cases with a higher degree of cost-efficiency across a variety of leading blockchains.

Common Use Cases Enabled By KCC VRF

Below is a brief summary of some of the most popular use cases.

Fair NFT Minting and Airdrop

The details of NFTs are made up of different attributes, such as BAYC’s NFT, including seven different attributes: background, clothing, earrings, eyes, hair, hat and mouth, and the rarity of attributes actually determines the value of the NFT. The allocation of rarity and the establishment of the upper limit of the total number of attributes can be solved by KCC VRF.

With the establishment and growth of more and more NFT communities, project parties often inspire their members’ loyalty and activity by handing out random NFT airdrop awards during special festivals or when certain milestones are reached. To ensure the fairness and address precision of airdrops, it needs to be carried out cautiously by the project side according to a certain distribution mechanism. KCC VRF can be seen as a good solution in such scenarios.

Lucky Draws and Community Giveaways

KCC VRF can be used for various raffles, draws, and giveaways to select winners from a set of eligible participants. KCC VRF helps bring unprecedented transparency to the winner selection process, something not seen in traditional draws conducted behind closed doors.

Player Versus Player (PvP) Battles

In a PVP game, the chances of a player winning and winning a prize may depend on the opponent they are assigned to in the game. If the game matching mechanism is unfair, it is likely to lead to the loss of players’ unfair matches. KCC VRF helps ensure that the gameplay and matchmaking are unbiased and tamper-proof, which is critical in play-to-earn games that feature monetary rewards for winners.

Start Building With KCC VRF Now


2023.03. 15