Let’s say you have some off-chain IP (ex. a book, a character, a drawing, etc). In order to register that IP on Story, you first need to mint an NFT. This NFT is the ownership over the IP. Then you register that NFT on Story, turning it into an IP Asset. The below tutorial will walk you through how to do this.
We can set metadata on our NFT & IP, but you don’t have to. To do this, view the IPA Metadata Standard and construct your metadata for both your NFT & IP.
main.ts
Copy
// you should already have a client set up (prerequisite)import { client } from "./utils";async function main() { const ipMetadata = { title: "Ippy", description: "Official mascot of Story.", image: "https://ipfs.io/ipfs/QmSamy4zqP91X42k6wS7kLJQVzuYJuW2EN94couPaq82A8", imageHash: "0x21937ba9d821cb0306c7f1a1a2cc5a257509f228ea6abccc9af1a67dd754af6e", mediaUrl: "https://ipfs.io/ipfs/QmSamy4zqP91X42k6wS7kLJQVzuYJuW2EN94couPaq82A8", mediaHash: "0x21937ba9d821cb0306c7f1a1a2cc5a257509f228ea6abccc9af1a67dd754af6e", mediaType: "image/png", creators: [ { name: "Story Foundation", address: "0x67ee74EE04A0E6d14Ca6C27428B27F3EFd5CD084", description: "The World's IP Blockchain", contributionPercent: 100, socialMedia: [ { platform: "Twitter", url: "https://twitter.com/storyprotocol", }, { platform: "Website", url: "https://story.foundation", }, ], }, ], };}main();
import { IpMetadata } from "@story-protocol/core-sdk";import { client } from "./utils";async function main() { // previous code here ... const nftMetadata = { name: "Ownership NFT", description: "This is an NFT representing owernship of our IP Asset.", image: "https://picsum.photos/200", };}main();
Remember that in order to register a new IP, we first have to mint an NFT, which will represent the underlying ownership of the IP. This NFT then gets “registered” and becomes an IP Asset.
Luckily, we can use the mintAndRegisterIp function to mint an NFT and register it as an IP Asset in the same transaction.
This function needs an SPG NFT Contract to mint from.
For simplicity, you can use a public collection we have created for you on Aeneid testnet: 0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc. On Mainnet, or even when testing a real scenario on Aeneid, you should create your own contract as described in the “Using a custom ERC-721 contract” section below.
Using a public collection we provide for you is fine, but when you do this for real, you should make your own NFT Collection for your IPs. You can do this in 2 ways:
Deploy a contract that implements the ISPGNFT interface, or use the SDK’s createNFTCollection function (shown below) to do it for you. This will give you your own SPG NFT Collection that only you can mint from.
Create a custom ERC-721 NFT collection on your own and use the register function - providing an nftContract and tokenId - instead of using the mintAndRegisterIp function. See a working code example here. This is helpful if you already have a custom NFT contract that has your own custom logic, or if your IPs themselves are NFTs.
Now that your IP is registered, you can create and attach License Terms to it. This will allow others to mint a license and use your IP, restricted by the terms.
We will go over this in the next section, but it’s worth mentioning that instead of using the mintAndRegisterIp function, you can register IP + create terms + attach terms all in the same step with the following functions: