A Fastify webapp on Glitch to make quick Stable Diffusion images and mint them as NFTs on Polygon using NFTPort and Covalent
This webapp seeks to take advantage of NFTPort's convenient and easy NFT minting utilities on Polygon to allow people to make NFTs of images made with Stable Diffusion.
One of NFTPort's goals is to show how NFT minting utilities can be created quickly given their minimalist and simple APIs. Given the ubiquitous popularity of images made with Stable Diffusion, I thought it would be a worthy exercise to create a rapid NFT minting utility for Stable Diffusion images. Covalent's API is also used as an easy way to check the status of the transaction.
The project is based on pure Fastify in Node.JS, without any additional dynamic web framework. In the ENV file, there are API keys for Replicate, NFTPort, and Covalent.
Using HTML forms, the user picks a label for a Stable Diffusion image. Right now, it just uses default settings and gives the process around 10 seconds to run. (However, it would be nice in the future to give the user full control of the Stable Diffusion instance). The app uses the Replicate compute-as-a-service API protocol to run Stable Diffusion.
This Replicate instance returns an image url, which is shown to the user. The user is given the option then to mint the NFT on Polygon and given a form for the name, description, and wallet. NFTPort takes care of everything, uploading the image to IPFS and minting the NFT to the provided wallet with the provided name and description.
The webapp finally returns a link to the polygonscan page for the transaction. It also automatically populates a simple form that checks the transaction status using the Covalent API.
The sponsor technology (NFTPort) did the most important work, which I think is the purpose of the hack, to show how valuable web apps that meet user demands can be made quickly with such commercial utilities. Of course, the affordability of the Polygon blockchain is also another factor that makes this all possible!