The initial idea our group found consensus on was to build a Covid-themed NFT that people would have delight in collecting, which would contribute towards an important social good.
The initial spark was the daily annoyance of scanning QR codes to check into indoor venues and workplaces. The thought was could NFTs be used to gamify this process and make it more fun: What if you could mint an NFT for every 10 or so instances that you check-in, and you can collect visually appealing NFTs with some being rarer than others.
The idea evolved into being a light-hearted reminder of the Covid era of human history, and incorporating a DAO to develop a community which is united by ownership of CovidCat NFTs, and jointly decides which charities to donate DAO funds to.
What it does
CovidCats is built on the prototype of the "10K PFP" project that saw viral hype in Q3 2021. Users click "Mint" on the website, and they will receive an instantly revealed CovidCat NFT with provably random traits.
How we built it
We implemented the following technology stack:
- Chainlink VRF function
- Next.js and React
We deployed our public test frontend to Heroku
The basic minting app logic is as follows:
- User clicks 'mint', this sends a request to the Chainlink VRF coordinator for a random number
- The Chainlink VRF sends back a random number, and a new CovidCat NFT will be minted to the user
- This random number is used to determine the traits of the newly minted NFT
- The image for the newly minted NFT is built and saved to IPFS on demand, and so is the metadata
- Both the image and metadata are built on-the-spot and saved to IPFS. The image and metadata IPFS link will appear on the website, just underneath the Mint button
We use Moralis to i.) Save the image and metadata to IPFS, ii.) Create an event listener for the Mint event, which is when the Chainlink VRF sends back a random number, iii.) Create a database of Mint events which records the random number and user for each CovidCat mint.
Challenges we ran into
Integrating the Chainlink VRF function to determine randomised NFT traits
- We found that there are two important bottlenecks for the Chainlink VRF function: i.) it requires the smart contract to pay 0.1 LINK per request on Ethereum mainnet and testnets, ii.) It asynchronously produces the random number 3-5 minutes after the initial request is made, it is not instantaneous to get the random number as one might initially expect.
- The latter prompts some thinking into how to design a good user experience around a random number generator that takes several minutes to work.
Implementing the logic to transform a random number and layer trait image files, into a single final NFT image file with all the traits rendered.
- We drew inspiration from the Hashlips Art Engine codebase to create this functionality - https://github.com/HashLips/hashlips_art_engine
- Moralis hugely simplified the work to create an event listener for the Mint event containing the random number from the Chainlink VRF function. With Moralis this would take ~5 lines of code, whereas it would ~20 without.
Integrating the frontend, backend and smart contract to work together as one cohesive app
- Integrating the React frontend framework with desired blockchain and backend functionality is a kind of mental gymnastics, and so is the process of deploying the entire integrated apps to a public website
Accomplishments that we're proud of
Conceptualising and building out CovidCats
Creating the CovidCats artwork
Creating the backend that listens for the Chainlink VRF-generated random number, takes the random number to generate an NFT with random traits, and then renders this NFT's image and metadata on the frontend for the user to enjoy.
What we learned
Moralis has a huge amount of use cases, and is sort of like a super library and even more for blockchain development. With our app, it hugely simplified the processes of uploading files to IPFS, and building a blockchain event database and event listener.
What's next for CovidCats
The following is on our roadmap
- CovidCats DAO
- Develop a DAO multisig wallet into which mint and resale fees will accumulate
- CovidCat socials: Twitter, Discord
- OpenSea integration
- Snapshot framework through which CovidCat NFT holders can decide which charity to donate to