With the upgrade to PlatON 1.2.0, the VRF random number capability provided by PlatON’s built-in contract is also fully open to use. Smart contract developers can use the random number contract provided by PlatON to obtain decentralized, verifiable, tamper-proof, and secure random numbers.
It’s difficult to independently generate unpredictable random numbers through consensus algorithms on the public chain. Generally, random numbers are acquired through parameters on the chain as the source of randomness, such as blockhash. Although blockhash is random, it may suffer detention by miners.
Chainlink has proposed an off-chain solution: In the random number solution of Chainlink V2, a random seed is generated by Chainlink off-chain, and a random number and a proof that can be verified on the chain are generated by the key of its node. Despite its extensive application, this solution charges additional fees.
Centralized random number providers may manipulate random numbers for profit. Traditional RNG solutions cannot prevent data from being tampered with, so users have no choice but to blindly believe in the authenticity and reliability of random numbers.
The on-chain random number of PlatON comes from the Nonce field in the block header, which uses the Nonce of the parent block as the seed and generates the random number with the private key signature of the proposer of the current block. In practical use, the [1,33] byte of this field can be taken as the random source of the verifiable random number.
Giskard, PlatON’s consensus algorithm, uses the VRF algorithm to select validators, and its on-chain Nonce (VRF and proof) is inherently secure, verifiable, random, and non-tamperable. Since all validators in the PlatON network will verify the Nonce field in the block header, this field will also be applied to the random selection of PlatON consensus nodes, the security of which has been fully proved. Although the proposer can obtain the random number in advance, no malicious behavior is allowed, which guarantees security. If this field is invalid, the current block cannot obtain the validator’s signature, and the confirmation fails.
Up to 500 random numbers can be returned on PlatON. Contract developers can use the random number without repeated verification at the contract layer or fees other than gas. They can obtain random numbers simply through contract calls, which is simple, efficient, and developer-friendly.
This article is reproduced from https://medium.com/platon-network/platon-launches-the-random-number-capability-7555427a1e9a