paint-brush
Using Code Interpreter to Review NFT Projects 🦾by@bankless
276 reads

Using Code Interpreter to Review NFT Projects 🦾

by Bankless - MetaversalAugust 16th, 2023
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

ChatGPT is an AI chatbot developed by OpenAI that can generate human-like responses based on text inputs. Code Interpreter 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.
featured image - Using Code Interpreter to Review NFT Projects 🦾
Bankless - Metaversal HackerNoon profile picture


Dear HackerNoon 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 a Code Interpreter look like?


I’ll share a general approach to the process below, and we’ll see how it goes!


-WMP

Reviewing NFT code with Code Interpreter

What’s ChatGPT, and 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.solNounsArt.solNounsAuctionHouse.solNounsDescriptor.sol,

NounsSeeder.solNounsToken.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, and so on and so forth. If you can think of 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

An example of a ChatGPT analysis hallucination


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 as 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!


Author Bio

William M. Peaster is the creator of Metaversal — a Bankless newsletter focused on the emergence of NFTs in the cryptoeconomy. He’s also a senior writer for the main Bankless newsletter.


Also published here.