Let’s say you generate an image using AI. Without adding a proper license to your image, others could use it freely. In this tutorial, you will learn how to add a license to your DALL·E 2 AI-Generated image so that if others want to use it, they must properly license it from you.In order to register that IP on Story, you first need to mint an NFT to represent that IP, and then register that NFT on Story, turning it into an IP Asset.
There are a few steps you have to complete before you can start the tutorial.
You will need to install Node.js and npm. If you’ve coded before, you likely have these.
Add your Story Network Testnet wallet’s private key to .env file:
.env
Copy
Ask AI
WALLET_PRIVATE_KEY=
Go to Pinata and create a new API key. Add the JWT to your .env file:
.env
Copy
Ask AI
PINATA_JWT=
Go to OpenAI and create a new API key. Add the new key to your .env file:
OpenAI CreditsIn order to generate an image, you’ll need OpenAI credits. If you just created an account, you will probably have a free trial that will give you a few credits to start with.
.env
Copy
Ask AI
OPENAI_API_KEY=
Add your preferred RPC URL to your .env file. You can just use the public default one we provide:
In a main.ts file, add the following code to generate an image:
main.ts
Copy
Ask AI
import OpenAI from "openai";async function main() { const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); const image = await openai.images.generate({ model: "dall-e-2", prompt: "A cute baby sea otter", }); console.log(image.data[0].url); // the url to the newly created image}main();
Now that we have all of our metadata set up, you can easily complete this tutorial by going to Register an IP Asset and completing steps 3 (Upload your IP and NFT Metadata to IPFS) & 4 (Register an NFT as an IP Asset).Once you have done that, you should see a console log with a link to our IP-explorer that shows your registered AI generated image.