Dear Bankless Nation,
Last month I wrote about crypto-themed ChatGPT plugins.
The AIâs creators have since released another powerful resource, Code Interpreter, thatâs really impressive.
It can actually do a lot more than just analyze code.
Yet as a creative in crypto Iâve always wanted to have a deeper understanding of smart contracts, so what could a basic code review of an NFT project with Code Interpreter look like?
Iâll share a general approach to the process below, and weâll see how it goes!
-WMP
đ Sponsor: Uniswap Labs â Better Prices, More Listings: NFTs on Uniswapâ¨
Reviewing NFT code with Code Interpreter
Whatâs ChatGPT, whatâs Code Interpreter?
ChatGPT is an AI chatbot developed by OpenAI that can generate human-like responses based on text inputs. It can be enhanced with plugins, which are third-party resources that allow the AI to interact with other software and services.
Code Interpreter itself is an in-house plugin developed by the OpenAI team. Itâs able to use the Python programming language to perform all sorts of different tasks, from pulling the color palette from an uploaded image to analyzing provided snippets of code.
Here, note that Code Interpreter is currently only available to ChatGPT Plus users, a monthly subscription to which costs ~$20 currently, and it must be opted into through the âBeta featuresâ section of the ChatGPT âSettingsâ menu.
Example: Digging into the basics of the Nouns DAO codebase with Code Interpreter
The Code Interpreter plugin, which is still in an experimental state, remains in a âsandboxed execution environmentâ and thus doesnât have internet browsing capabilities for now.
That said, if you want Code Interpreter to examine code, youâll have to copy and paste in snippets into ChatGPT as needed at the moment. In this instance, I have the Nouns DAO GitHub repository ready to go, so we can begin like soâŚ
1. Seed the chat with context
Nouns DAO, as its repo shows, is composed of a range of interlocking smart contracts. To make this info digestible for Code Interpreter, I copied over the code of these individual smart contracts one by one: Inflator.sol, NounsArt.sol, NounsAuctionHouse.sol, NounsDescriptor.sol, NounsSeeder.sol, NounsToken.sol, and SVGRenderer.sol.
The âArtâ smart contract alone was 450 lines of code, so itâs interesting to see the plugin handle large chunks of info at a time like that. After Code Interpreter has all the relevant smart contract details at its disposal, you can start guiding it to dig in further.
2. Ask your research questions
With Code Interpreter having a handle on a projectâs codebase, you can then use the plugin as something akin to a research assistant for understanding the code.
For example, I asked Code Interpreter to provide a high-level analysis of Nouns DAOâs technical design after providing it with the seven aforementioned smart contracts. To this, the plugin brought up various good points like:
- The modular design: âThe project is structured in a modular way, with each contract responsible for a specific part of the system. This helps in maintaining the code and allows for flexibility in updating parts of the system independently.â
- Onchain art generation: âUnlike many NFT projects that store metadata and art off-chain (usually on IPFS or similar), Nouns DAO appears to have the capability to generate art on-chain using the NounsArt.sol, NounsDescriptor.sol and SVGRenderer.sol contracts. This approach is less common and provides a unique mechanism for creating distinct and verifiable digital assets entirely within the Ethereum blockchain.â
- Usage of OpenZeppelin: âThe project makes use of the OpenZeppelin libraries, which are industry standard, well-tested, and secure implementations of common contract interfaces and utilities. This demonstrates a focus on security and reliability.â
If I was going 0 to 100 in researching an NFT project that I wasnât familiar with, would I find this sort of info useful as a starting point on the technical side of things? Absolutely! Youâre also pretty much only limited by your imagination here. I asked Code Interpreter how a streamlined version of the Nouns architecture might look, so on and so forth. If you can think it, the plugin can try answering it.
Yet you also have to be really careful because not all the answers you receive from Code Interpreter will be correctâŚ
3. Watch out for hallucinations
In actuality, the Inflator.sol smart contract used by Nouns DAO is meant to âdecompress data compressed using the Deflate algorithm.â The code tells you as much in plain English!
Yet on one pass through when I asked Code Interpreter to analyze this portion of the Nouns technical structure, the plugin incorrectly indicated this element was interesting as a finance-centric âinflation rate mechanism which can be seen in some DeFi protocols but is not commonly seen in NFT projects.â
The point here, then, is that Code Interpreter is still experimental and far from infallible. Donât treat its answers as entirely correct, because oftentimes in various places they wonât be. Sometimes rephrasing your prompt in certain ways can fix these hiccups, but if you do use Code Interpreter in the near future, be sure to get in the practice of double checking its outputs like I did with its analysis of the Inflator.sol contract!
Zooming out
All in all, Code Interpreter is a really compelling new tool that both non-technical and technical people can use to, among other things, analyze NFTs more deeply. Code analysis used to only be the terrain of experts, but this pluginâs a big step toward making it more accessible and understandable for anyone.
Itâs also quite early on in this field, so I suspect the performance of Code Interpreter and plugins like it will only improve over time. However, if youâre a non-coder like me, itâs especially important to remember to use this tool as just another element of your research and as a source that needs to be fact-checked just like anything else, rather than as some sort of perfect analysis machine, which itâs not!