CosmicSwap Integrates Chainlink VRF into our Lottery System.

3 min readMay 28, 2021

We’re excited to announce that CosmicSwap — an innovative yield farm on the BSC — has integrated Chainlink Verifiable Random Function (VRF) on the Binance Smart Chain mainnet.

By integrating Chainlink’s industry-leading decentralized oracle network, we now have access to a tamper-proof and auditable source of randomness needed to run a successful lottery system. The lottery system on CosmicSwap will run as follows. By using the random function, it is generating 4 random numbers for the lottery. These 4 random numbers then decide the winners of the lottery. The lottery tickets have 4 random numbers on them so if all 4 random numbers on the ticket match with the 4 winning random numbers, the user has won the highest price-pot in the lottery. If only 3 or 2 numbers match, the user will still win smaller pots in the lottery. Ultimately this creates a more exciting, transparent, and fraud-proof user experience, as users can rely on a fair and random lottery system on the CosmicSwap platform.

CosmicSwap is a yield farm on the Binance Smart Chain. CosmicSwap is unique as there is a low total supply of tokens (205,000), the development team is public, and has plans for more than just a yield farm. By initially starting a yield farm on the BSC, CosmicSwap has built a great community on social media networks, especially on Twitter and Telegram. CosmicSwap plans to leverage this active community by expanding into other areas such as a lottery system, a wide variety of NFTs, and more.

In order to for CosmicSwap to run a successful lottery system, we need access to a secure random number generator (RNG) that any user could independently audit. However, RNG solutions for smart contracts require several security considerations to prevent manipulation and ensure system integrity. For instance, RNG solutions using on-chain data like block hashes can be exploited by blockchain miners, while off-chain RNG solutions like traditional data providers are opaque and don’t provide users with definitive proof about the integrity of the process.

After reviewing various solutions, we selected Chainlink VRF because it’s based on cutting-edge academic research, supported by Chainlink’s time-tested oracle infrastructure, and secured through the generation and on-chain verification of cryptographic proofs that guarantee the integrity of each random number supplied to smart contracts.

Chainlink 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 CosmicSwap smart contract will only accept the random number input if it has a valid cryptographic proof, and the cryptographic proof can only be generated if the VRF process is tamper-proof. This provides our users with automated and verifiable assurances directly on-chain that CosmicSwap is provably fair and cannot be tampered with by the oracle, outside entities, or the CosmicSwap team.

“Cosmicswap was created with a purpose. Our mission is to create a sustainable and lasting yield farm. That’s why we took initiative to create a sustainability plan. Integrating Chainlink VRF into our lottery platform will allow us to create a fair and well managed system“— Azure, Founder

About Chainlink:

Chainlink is the most widely used and secure way to power universally connected smart contracts. With Chainlink, developers can connect any blockchain with high-quality data sources from other blockchains as well as real-world data. Managed by a global, decentralized community of hundreds of thousands of people, Chainlink is introducing a fairer model for contracts. Its network currently secures billions of dollars in value for smart contracts across the decentralized finance (DeFi), insurance, and gaming ecosystems, among others.

Chainlink is trusted by hundreds of organizations to deliver definitive truth via secure, reliable data feeds. To learn more, visit, subscribe to the Chainlink newsletter, and follow @chainlink on Twitter.

Docs | Discord | Reddit | YouTube | Telegram | Events | GitHub | Price Feeds | DeFi | VRF

Join our CosmicSwap Community:
🌐 Website:
👩‍💻 Github:
🐤 Twitter:
📕 Medium:
◀ Telegram:
📜 Documentation: