HeroFi Using Chainlink VRF for Verifiable Randomness During Hero Egg NFT Minting

4 min readOct 8, 2021

We’re excited to announce that HeroFi, a growing NFT-based gaming project — has integrated Chainlink Verifiable Random Function (VRF) on Binance Smart Chain (BSC) mainnet. By integrating the industry-leading decentralized oracle network, we now have access to a tamper-proof and auditable source of randomness needed to randomly assign traits to new NFTs hatched from our Genesis Hero Eggs. Ultimately this creates a more exciting, transparent, and fraud-proof user experience, as users can enjoy the benefit of having completely transparent gameplay and fair NFT distribution — no player will have an unfair in-game advantage.

HeroFi is an NFT game where players can come and gather assets, from tokens to NFT Heroes, which hold actual real-life value. In the HeroFi universe, players can immerse themselves in a fantasy world of legendary figures and create their own heroic battles, with the opportunity to earn rewards from their magnificent gameplay. Learn more about the game at the bottom of the blog post.

Genesis Heroes in HeroFi

In order to help ensure random and transparent outcomes for the Genesis Hero Egg hatching process and similar in-game activities, we needed 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 derived from blockchain data like block hashes can be exploited by miners/validators, while off-chain RNG solutions derived from off-chain APIs 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 time-tested oracle infrastructure, and secured through the generation and on-chain verification of cryptographic proofs that prove 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 HeroFi 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 HeroFi is provably fair and was not tampered with by the oracle, outside entities, or the HeroFi team.

Chainlink’s randomness mechanism

“We decided to integrate Chainlink VRF because we believe the Chainlink network is highly reliable and seamless to implement within our smart contract. Ultimately, this integration will help provide HeroFi’s community with greater security and fairness when it comes to in-game entropy and NFT distribution, which will build an unwavering trust within our community.” — Charles Pham, CEO of HeroFi

About Chainlink

Chainlink is the industry standard for building, accessing, and selling oracle services needed to power hybrid smart contracts on any blockchain. Chainlink oracle networks provide smart contracts with a way to reliably connect to any external API and leverage secure off-chain computations for enabling feature-rich applications. Chainlink currently secures tens of billions of dollars across DeFi, insurance, gaming, and other major industries, and offers global enterprises and leading data providers a universal gateway to all blockchains.

Learn more about Chainlink by visiting chain.link or read the documentation at docs.chain.link. To discuss an integration, reach out to an expert.

About HeroFi

HeroFi is a Free-to-Play, mobile aRPG game where anyone can come play and gain tokens from PvP/PvE battles between Heroes. It is a blockchain game that allows players to earn crypto tokens and create NFT heroes within the game’s virtual world. HeroFi offers a variety of game modes in order to exceed our players’ wildest expectations. Moreover, the HeroFi world consists of many Heroes with unique designs, and different regions with all kinds of terrains, which guarantees the highest level of satisfaction. On top of that, all of the players’ assets can be easily traded on decentralized exchanges.

Entering the HeroFi multiverse, players are given the opportunity to dwell in the mythical realm of Gods and Heroes and clash with other players. Anyone from an avid gamer to a hardcore investor can find their own path to build a fortune in HeroFi. The key takeaway about HeroFi is its Hero system, which is divided into 2 domains, Genesis Heroes and Normal Heroes.

Genesis Heroes require $HEROEGG tokens to hatch. And once they get their upgrades, the value they hold in the Marketplace can become higher. On the other hand, Normal Heroes can be gifted to players and given birth to. They can have more Classes linked to their skill sets compared to Genesis Heroes, making the battles more unpredictable and strategy-driven.

In addition to the in-game possessions accumulated, the HeroFi community also gains amazing experience from the great gameplay and the one-of-a-kind graphic design that the HeroFi development team has put a good deal of time and effort into.