Case Study: User curated AI generated NFTs
In an earlier article we discussed what an NFT (Non Fungible Token) actually is. In this case study we will deep dive on the unique problems that Logicful helped to solve for one of our clients in the web3 industry for their NFT launch.
The business intention
Our client had created a world leading AI capable of generating art in a myriad of different styles. Fantastic impressionism, breath taking classical and thought provoking modern art processed in ~30 seconds. Groundbreaking technology, however they were struggling to monetise — a task that Logicful set out to solve.
We proposed a novel and unique NFT experience: Users seed the AI with a phrase or instruction, refresh the output until they are happy, then mint this generated artwork into a limited supply NFT collection.
To recap:
User inputs a phrase or instruction
AI generates a beautiful, unique piece of art based on the string
User mints the art as an NFT
The technical challenges
The above may sound relatively straight forward, however it creates some fairly novel technical challenges in the NFT space. In a previous article, we already discussed linking NFTs to off chain data. However, this linking is usually carried out a few days after the mint has taken place. As all data on the Ethereum blockchain is public, if you provide the information of where any off chain assets reside while the mint is still live, it is fairly trivial for a rogue actor to ensure they purchase a particular NFT with desirable traits. Traditionally NFT projects do not reveal what you have actually purchased until a few days after the collection has fully minted out. These NFTs would be unique pieces of artwork, so the threat of users front running the transactions of others to get a desirable piece solved itself. However, there was a secondary technical problem with this novel NFT design: we needed to send the IPFS hash of an image at the point a user minted their NFT.
Anyone not familiar with an NFT mint or the blockchain in general may wonder why this is such an issue. We need to remember that this mint function on our smart contract is public. We may create a frontend interface to allow users to interact with it, however this doesn’t stop anyone interacting with the contract directly, or with an online tool like etherscan. So, how do we ensure that only information provided by us, the contract creators, is sent to a public function on our smart contract? With cryptography of course!
Vitalik Buterin, creator of Ethereum. If you want to read a very in depth analysis of elliptic curve pairings from him, you can do so here.
More specifically, with Elliptic Curve Digital Signature Algorithm (ECDSA) operations. In slightly more layman’s terms, if we sign a specific message (in our case, the component parts of the input to our mint function that we want to ensure came from ourselves) with the private key of a public/private key pair (still following?), we can reconstruct that message in our smart contract and verify that the public key that signed the message is the one that we expect. Simple, right? The code that we used to accomplish this can be boiled down to the following snippet:
This is an extract from a larger library by OpenZeppelin that makes working with ECDSA simple. You can see the rest of it here.
The outcome
So, that’s exactly what we did. We created a public/private key pair, setting the public side of this in our contract and storing the private key safely on the server side of our application. When a user was happy with their AI generated image, we uploaded this to IPFS and created a signed message on the server side using the private key. When a user selected to mint this image, this signed message was sent to the contract where it was verified using the method above. Therefore stopping any bad actors from using the contract for unintended use — namely minting images not generated by the AI in question into the limited collection.
In conclusion, the Logicful created solution was a huge technical and commercial success. The client enjoyed a complete sale of all 10,000 AI generated images in the collection, earning $3.1M in 10 hours. At the time of this article, the secondary market on these pieces has seen nearly 4,700 ETH in trading volume.
An actual NFT generated by the AI and minted using the method described in this article — verified to have come from the AI.
Wondering how Logicful can help your business overcome any hurdles you are experiencing? Get in contact.