Kitsumon x Chainlink

Kitsumon
4 min readFeb 1, 2022

Kitsumon is an NFT game centered around adorable 3D Kitsu creatures that you can breed, battle, bond, and explore with. For our INO, we are using a Blind Box system to distribute our Kitsu NFTs.

We are happy to announce that we have integrated Chainlink Verifiable Random Function (VRF) on Polygon mainnet to randomly determine the Kitsu NFT each user will receive from their Blind Box. Chainlink VRF lets us easily generate a 256-bit random number, and anyone can verify the on-chain cryptographic truth to verify that the randomness was tamper-proof. We have chosen Chainlink VRF because fairness is a large focus here at Kitsumon and we want to ensure that everyone has an equal opportunity to get the Kitsu egg they desire.

Because the Kitsumon INO is held on several different Launchpads that all have their own individual pools, the Random Box contract always contains the state information of the available prizes for each Launchpad.

Launchpad Example Pool A

This is only an example and does not represent actual egg rarities.

  • 100 Skyfall
  • 200 Kitsune
  • 200 Geodite

Each Random Box will be allocated to its own specific pool, depending on where you bought it from. When the user proceeds to open the box, the contract will request a random number from Chainlink VRF.

Note the exact function that initiates the request is called “requestRandomness” on line 112. The VRF function will then wait for a few blocks to get a secure-provable-random and then return a callback function inside the contract. The following image shows how this callback is executed when the VRF is ready, through the method “fulfillRandomness”.

If you know some coding you probably noticed that we don’t have the logic for deciding the reward and minting in this function. This is because if this method goes above 200K gas then the function will not be executed. With this in mind, we deferred the execution of calculating the reward and minting the NFT to another user-callable public method called “finalize”. In the fulfillRandomness method, we keep gas consumption low by storing the request ID against a result in a mapping, as shown on line 172.

Below you can find a visualization of the “finalize” method. The used variable “randomness” can range from 0 to 1.1579 x 1⁰⁷⁷

This diagram describes the selection of the reward

And lastly, the finalize method takes the result given by Chainlink VRF and caps it based on the “totalNft” size on line 128. Any number that overflows will be rolled over, so if the number is 101 and the remaining NFTs in the pool are 99, then the reward position will be 101 % 99 = 2.

One of our founders, James Kirkby, has said the following about our choice to integrate Chainlink VRF:

“Chainlink is one of the few projects in the crypto space that adds true value to the wider blockchain ecosystem. The ability to take off-chain data and use that as a trusted input in smart contracts opens up endless use cases.

For us, choosing a technology solution to integrate with always comes down to a couple of factors — the reputation and longevity of a project and its team, as well as its ease of integration in our technology stack. Chainlink’s reputation speaks for itself, but as a developer working with the code, we always found great care and detail in Chainlink’s documentation and always found it very easy to work with.”

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 reading the developer documentation at docs.chain.link. To discuss an integration, reach out to an expert.

About Kitsumon

Kitsumon is an NFT game centered around adorable Kitsu creatures that you can breed, battle, bond and explore with. Unlike current popular NFT games, Kitsumon does not stick to one type of gameplay that users have to follow — players can become successful and earn in the game through a vast variety of playstyles. Whether you enjoy battling in MOBA PvP, earning your keep through professions like fishing, crafting and cooking, or you love breeding Kitsu together for all-new awesome creations. Kitsumon offers all of it and more. But it doesn’t end at just having good gameplay — the graphics and models are developed in Unity 3D down to beautifully precise detail by our partner — ADIA!

--

--

Kitsumon

#Kitsumon is an #NFT based game built on Polygon Network. Create unique Kitsu, master professions, and challenge other players! #NFTgaming #NFTcollectors