NEW
Chainlink Keepers Open Beta is now live.
Read the announcement.

Aavegotchi Uses Chainlink VRF to Pioneer Dynamic NFTs on Layer 2

“It’s a huge value-add knowing all Aavegotchis are summoned with Chainlink VRF. There’s nothing that comes close to Chainlink for ensuring a provably fair gaming experience on-chain.”
Photo of Jesse Johnson

Jesse Johnson

Founder and COO,

Pixelcraft Studios

Key results

$14M+

in volume

500,000+

transactions

$14M+

saved in user gas fees
Aavegotchi logo

Aavegotchi is a DeFi-enabled crypto collectibles game developed by Pixelcraft Studios that allows players to stake non-fungible token (NFT) avatars with interest-generating aTokens and interact with the Aavegotchi metaverse. Aavegotchi combines Decentralized Finance (DeFi) and NFTs to create a financially-incentivized gaming experience.

Overview

Aavegotchi is an NFT collectibles game that uses Aave’s interest-bearing aTokens as DeFi collateral to mint NFT avatars. Players aim to increase the value of their Aavegotchi NFTs by “farming rarity” in various gamified ways on-chain.

Challenge

Aavegotchi needed a provably fair and tamper-proof way to determine the composition of newly minted NFT avatars and distribute rare attributes to existing avatars through on-chain raffles.

Solution

Chainlink Verifiable Randomness Function (VRF) is a decentralized, oracle-powered service that provides smart contracts with a secure source of on-chain randomness that all users can independently verify.

Situation

Aavegotchi’s Quest to Gamify NFT Rarity

Non-Fungible Tokens (NFTs) have generated a massive uptick of interest, both from creators launching NFTs to monetize their one-of-a-kind crypto collectibles and enthusiasts buying NFTs for personal and financial interests. The large majority of first-generation NFTs centered around the idea of using a blockchain’s persistent, immutable ledger to launch and track verifiably unique tokenized assets. While some first-generation NFTs went on to sell for millions of dollars, many others failed to gain traction. Some termed this waning of consumer interest as the NFT “scarcity meme”, where an NFT was only perceived to have value because of its rarity. Users’ interest quickly faded once they realized all they owned was a static digital image.

In January 2021, Aavegotchi launched on the Ethereum mainnet, with the vision of providing users a new blockchain-based “rarity farming metagame” powered by dynamic, DeFi-enabled NFTs. Aavegotchis, inspired by the handheld pet Tamagotchis of yesteryear, are digital avatars with varying rarity that players are incentivized to nurture and level up. They can be minted by staking Aave’s interest-generating aTokens, as well as earned, upgraded, and purchased through various gamified elements and secondary markets.

Challenge

Build a Provably Fair NFT Game at Scale

  • Obtain a secure source of randomness that’s not subject to on-chain attacks like block reorgs from miners, or the opaqueness of off-chain RNG data providers.

  • Access a transparent source of randomness that provides verifiable proof that the RNG process is unbiased and tamper-proof.

  • Call the randomness function at high frequency while minimizing on-chain transaction costs, ensuring users have a seamless experience when interacting with the Aavegotchi metaverse.

One of the foundational elements of Aavegotchi’s game mechanics is randomness, which is critical for minting every new Aavegotchi avatar and updating existing NFTs using raffle-based distributions of rare attributes. However, building a financially gamified and entropy-filled universe required Aavegotchi to have a high-frequency and provably fair source of randomness that no entity can predict or manipulate to obtain the rarest NFTs. The team developing the Aavegotchi platform needed a low-cost Random Number Generator (RNG) that is open-source and verifiable, meaning any user can confirm the integrity of the RNG.

A random number generator (RNG) is the most common way to produce entropy. It uses a seed value to generate a random number based upon some predefined parameters (e.g, 1-1,000). The random number is then used as an input to produce an outcome according to a preset list of possibilities. While it may seem easy on the surface, generating randomness in a way that’s verifiably tamper-proof and unpredictable is a complex computer science problem.

On-chain RNG techniques—random numbers derived from blockchain activity like a block hash—have vulnerabilities that can be exploited by miners. Most notably, miners can reorder transactions within blocks to alter the random number input and achieve a more favorable outcome. Alternatively, off-chain RNG solutions—random numbers derived from a data provider’s API—are opaque and offer no real proof that the data provider can’t tamper with the RNG process and/or frontrun transactions based on the random input they supply. Both on-chain and off-chain RNG approaches have serious limitations that would undermine the security of Aavegotchi’s overall game design, especially as Aavegotchis rise in value and malicious actors have greater incentive to manipulate NFT minting and attribution.

In addition to RNG source considerations, layer-1 blockchains like Ethereum were currently not practical from a cost perspective to support high volume games like Aavegotchi without severely limiting the user experience. Users are unlikely to participate in the Aavegotchi universe if they have to make substantial on-chain payments every time they interact with their Aavegotchi, ultimately reducing the element of competition and unpredictability that makes games exciting and financially rewarding.

“We looked at quite a few RNG alternatives. There’s really no other RNG solution that solves for both on-chain miner-related attacks and the opaqueness of off-chain data providers. That’s why we’re really comfortable with Chainlink.”
Photo of Coder Dan

Coder Dan

CEO, Pixelcraft Studios

Solution

Chainlink VRF on Polygon’s Layer 2 Network

Chainlink Verifiable Function (VRF) is an RNG service performed by Chainlink oracles using a hybrid on-chain/off-chain architecture. 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 off-chain. The cryptographic proof is generated off-chain in a low-cost manner but verified on-chain to confirm the integrity of the off-chain RNG process.

The Aavegotchi smart contract will only accept the random number if it has an associated cryptographic proof, and the cryptographic proof can only be generated by Chainlink VRF if the process is fully tamper-proof. Thus, Aavegotchi users receive extremely high assurances that every source of entropy supplied by Chainlink VRF is provably fair and unbiased, as neither the oracle node, external entities, nor Aavegotchi developers can predict or influence random outputs to their own advantage.

Importantly, Chainlink is a blockchain agnostic protocol, meaning its oracle solutions can be natively integrated on various blockchain networks. This flexibility of design allowed Chainlink VRF to launch directly on Polygon—a highly scalable, low-cost layer-2 sidechain aggregator. Aavegotchi was able to leverage Chainlink VRF on Polygon without dependencies on any other blockchains, ultimately enabling Aavegotchi to call Chainlink VRF for a thousandth of the cost required on Ethereum’s layer-1 blockchain.

“One of the reasons we decided to build on Polygon was because Chainlink VRF was integrated with Polygon.”
Photo of Coder Dan

Coder Dan

CEO, Pixelcraft Studios

Aavegotchi has already called Chainlink VRF tens of thousands of times to mint 10,000 NFTs. This includes leveraging Chainlink VRF several times for its mainnet raffles, where one lucky user out of 16,000 participants won a god-like LINK-cube NFT, the most powerful item in the game, all without any discrepancies in the raffle's integrity.

By introducing verifiable randomness, Aavegotchi has pioneered a new game design that they dub as a “rarity farming meta-game.” This metagame is a competition between users trying to farm the rarest Aavegotchis, either by minting a new one right out of the portal, leveling up existing NFTs by winning raffles and other games, or buying Aavegotchi NFTs and wearable upgrades sold on secondary markets. Thus, not only are Aavegotchi rare NFTs, but they are “farmable” through a no-loss game that’s backed by real interest-generating assets—combining DeFi, NFTs, decentralized gaming, and real-world inputs to create an unparalleled player experience.

Business Outcomes

Dynamic NFTs That Keep Users Coming Back for More

Since its mainnet launch at the beginning of 2021, Aavegotchi has turned into a top 10 NFT project on DappRadar. Running on Polygon’s low-cost layer-2 network has enabled the Aavegotchi platform to securely handle over 500k+ on-chain transactions and save users over $14M in transaction costs, while guaranteeing fair NFT generation and exciting in-game outcomes through Chainlink VRF.

The extensive amount of on-chain activity is a clear testament to the growing user demand for fun gamified experiences mixed with financial incentives. Not only does Aavegotchi’s integration with Chainlink showcase a completely new use case within the NFT economy, but it redefines how gaming experiences in general can be successfully monetized using dynamic NFTs that incentivize users to collect, earn, trade, and interact with their collectibles. “Unlike a lot of NFTs,” explained Founder Jesse Johnson, “this one really rewards you if you take care of it.”

A secure source of randomness is the lynchpin of Aavegotchi’s platform design. Emerging at the nexus of DeFi and blockchain gaming, Aavegotchi must provide users the same security and transparency guarantees that have come to characterize the larger smart contract ecosystem. As the CEO of Pixelcraft Studios, Dan the Coder, made clear, “When you have randomly generated traits that influence the outcome of your game, you’re going to see a lot of value behind these traits. We’re seeing Aavegotchis going for tens of thousands of dollars almost every day on the secondhand market. Imagine if those Aavegotchi were not produced using Chainlink VRF: there would be a lot of questions about their value and whether their traits can be manipulated. Chainlink provides definitive, undisputed answers to these questions.”

Launch dynamic NFTs with Chainlink VRF

Talk to an expert

Stay updated on the latest Chainlink news