Back to the list

PancakeSwap integrates Chainlink’s random number generator for V2 of lottery


www.cryptoninjas.net 15 July 2021 07:15, UTC
Reading time: ~2 m

PancakeSwap, the automated market (AMM) and yield farm platform built on Binance Smart Chain (BSC), today announced its mainnet integration of the Chainlink’s Verifiable Random Function (VRF).

Chainlink VRF provides cryptographically secure randomness for blockchain-based gaming applications. It will provide a provably fair source of randomness used to select winners in Pancake Swap’s Lottery V2 application; along with a supporting cryptographic proof that verifies the RNG process as tamper-proof.

Recap of PancakeSwap Lottery

  1. The PancakeSwap Lottery has two draws every day.
  2. Users can participate by buying tickets, which each contain 6 digits.
  3. Prizes are determined by how many digits are on a user’s ticket (and match the digits from Chainlink VRF).

The breakdown is as follows:

“The new lottery has already become hugely popular, with the largest prize pool to date totaling around $1.165M (77,687 CAKE) in round 16. Given the value at stake, it was very important to bring transparency and security to the winner selection process so no single party could unfairly influence the results. However, accessing a manipulation-resistant source of randomness on-chain in a verifiable manner isn’t as straightforward as it might seem. On-chain RNG solutions like blockhashes can be subject to miner manipulation; while off-chain RNG solutions are opaque and provide no proof of integrity. Overcoming these hurdles is why we selected Chainlink VRF for the PancakeSwap Lottery V2.”
– The PancakeSwap Team

How It Works

On a technical level, Chainlink VRF functions by combining block data that is still unknown when the request is made; with the oracle node’s pre-committed private key. This combination is used to generate both a random number and a cryptographic proof.

PancakeSwap’s Lottery V2 smart contract 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. This provides users with automated and publicly verifiable assurances that each random number draw is provably fair and can’t be tampered with or predicted by the oracle, outside entities, or the PancakeSwap team.

Back to the list