DeFi City Integrates Chainlink VRF to Generate Random Numbers in Smart Contracts (provide randomness for drawing NFT)

4 min readAug 13, 2021


DeFi City Integrates Chainlink VRF to Generate Random Numbers in Smart Contracts

We’re excited to announce that DeFi City — a browser-based virtual world that gamifies and simplifies DeFi yield farming — has integrated Chainlink Verifiable Random Function (VRF) on the Binance Smart Chain (BSC) 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 generate the DeFi City NFTs when a scroll is opened. Ultimately this creates a more exciting, transparent, and fraud-proof user experience, as users can get random, fun NFTs each time.

As a reward-generating gamified ecosystem powered by NFTs, where users can own virtual cities in our DeFi metaverse, add their elements as they want, and reap the rewards. DeFi City can leverage Chainlink to bring the best of DeFi to create a unique, engaging experience for each user on the platform.

DeFi City NFTs

In order to create a better, fun-filled experience for our users, 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 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 DeFi City 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 our users with automated and verifiable assurances directly on-chain that DeFi City is provably fair and cannot be tampered with by the oracle, outside entities, or the DeFi City team.

DeFi City Scroll Opening Process Diagram

Chainlink VRF will help DeFi City with the most secure, transparent source of on-chain randomness to generate NFTs for our users. We are further planning to use Chainlink’s data feeds to fetch prices for users in the future, which will allow our users to enjoy the experience.

About Chainlink

Chainlink is the industry standard oracle network for powering hybrid smart contracts. Chainlink Decentralized Oracle Networks provide developers with the largest collection of high-quality data sources and secure off-chain computations to expand the capabilities of smart contracts on any blockchain. Managed by a global, decentralized community, Chainlink currently secures billions of dollars in value for smart contracts across decentralized finance (DeFi), insurance, gaming, and other major industries.

Chainlink is trusted by hundreds of organizations, from global enterprises to projects at the forefront of the blockchain economy, to deliver definitive truth via secure, reliable oracle networks. To learn more about Chainlink, visit, subscribe to the Chainlink newsletter, and follow @chainlink on Twitter. To understand the full vision of the Chainlink Network, read the Chainlink 2.0 whitepaper.

Solutions | Docs | Discord | Reddit | YouTube | Telegram | GitHub

About DeFi City

DeFi City aims to democratize decentralized finance products and lower the barriers to entry for new users through gamification. Serving as an integrated platform, the game will allow players to invest in protocols across multiple chains, thus simplifying the DeFi experience for new users while making portfolio management more efficient for the pros.

For any questions, please feel free to reach out to us on:

Website | Telegram | Twitter | Discord | Newsletter | Medium




The Gamified DeFi Ecosystem BUILD, TRACK, EARN By providing an all in one overview of your favorite DeFi farms in a gamified, NFT-based world you will be up to