A ChatGPT Whimsy: NFT Contracts Built with AI
ChatGPT is a trove of potential, and the recent OpenAI paper squarely put Blockchain Dev as a career at risk from its growth.
We decided to set our own task to it after seeing experiments filter through our feeds from coders across Twitter.
We asked ourselves: can AI create effective NFT contract code?
Brief
It was time for ChatGPT to make it onto OpenSea by building an NFT collection.
While we wanted GPT to do the heavy lifting, there was always going to be an element of human interaction. We set some ground rules to make sure AI remained central to this tinker:
- We couldn’t code anything
- We could give feedback
- We could add / remove features
Whatever code was realized at the end of the development process would then be pushed live. Bugs, quirks, and kinks would all be included.
Process
To skip to the really good bit, you can check out the landing page to mint.
First, we had GPT outline a plan to develop a simple NFT contract.
The result was useful, but we felt that it needed additional detail, by storing 1s and 0s as pixels on-chain.
The above wouldn’t compile in Remix. It took around ~10 attempts with GPT to generate code that would.
We then got creative and asked it to make changes to Total Supply, Mint Price and other features.
Next up was the front-end UI.
We weren’t able to get GPT to build one alone with the current contract, so we took a template and asked it instead to modify the code. We then let it loose on the styling.
Finally, we needed a name. GPT was kind enough to provide a few examples for us too.
Future
As with any tinker, we used this opportunity to glean something useful from the process and consider ways to improve future iterations.
Aside from refining the skill of actually positioning statements to GPT (which is an article in itself), our reflections settled on two areas. The limitations of using GPT to code and what we can do next with it.
GPT was an insightful experiment but there will always be questions around its safety. While we look to reduce time spent on tasks, and automate wherever possible, something with GPT’s capability needs to be implemented with caution to ensure glaring, costly errors don’t slip through lax development processes. (That being said, some friendly hackers did attempt a reentrancy attack with no luck. So, it's 1-0 to GPT.
The second area of thought was one of excitement, in asking ourselves: ‘what next?’. GPT was able to execute the functional elements of building an NFT project and it would be interesting to see if we can engineer its responses to then plan and execute marketing campaigns, organize a community around it, and so on.
If you didn’t catch the link above, you can mint a GPT-built NFT here on mainnet.
Important note: this contract was an experiment and has not been audited. As always, DYOR and stay safe.