Skip to main content
This section demonstrates how to register an IP Asset as a derivative of another.

Prerequisites

There are a few steps you have to complete before you can start the tutorial.
  1. Complete the TypeScript SDK Setup

1. Before We Start

Registering a derivative IP Asset requires you have a License Token from the parent IP Assets you plan to be a derivative of. If you don’t, the SDK will handle it for you.

1a. Why would I ever use a License Token if it’s not needed?

There are a few times when you would need a License Token to register a derivative:
  • The License Token contains private license terms, so you would only be able to register as a derivative if you had the License Token that was manually minted by the owner. More on that here.
  • The License Token (which is an NFT) costs a mintingFee to mint, and you were able to buy it on a marketplace for a cheaper price. Then it makes more sense to simply register with the License Token then have to pay the more expensive defaultMintingFee.

2. Register Derivative

In this example we’re going to assume you have no license tokens, the child IP is not yet registered, and you don’t have your own NFT contract or an already minted NFT.
main.ts
import { IpMetadata, DerivativeData } from "@story-protocol/core-sdk";
import { client } from "./utils";
import { uploadJSONToIPFS } from "./uploadToIpfs";
import { createHash } from "crypto";
import { Address } from "viem";

async function main() {
  // previous code here ...

  const derivData = {
    // TODO: insert the parent's ipId
    parentIpIds: [PARENT_IP_ID],
    // TODO: insert the licenseTermsId attached to parent IpId
    licenseTermsIds: [LICENSE_TERMS_ID],
  };

  const response = await client.ipAsset.registerDerivativeIpAsset({
    nft: {
      type: "mint",
      spgNftContract: "0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc",
    },
    derivData,
    ipMetadata: {
      ipMetadataURI: `https://ipfs.io/ipfs/${ipIpfsHash}`,
      ipMetadataHash: `0x${ipHash}`,
      nftMetadataURI: `https://ipfs.io/ipfs/${nftIpfsHash}`,
      nftMetadataHash: `0x${nftHash}`,
    },
  });

  console.log(
    `Completed at transaction hash ${response.txHash}, IPA ID: ${response.ipId}, Token ID: ${response.tokenId}`
  );
}

3. View Completed Code

Congratulations, you registered a derivative IP Asset!

4. Paying and Claiming Revenue

Now that we have established parent-child IP relationships, we can begin to explore payments and automated revenue share based on the license terms. We’ll cover that in the upcoming pages.
I