As developers, we understand the power of APIs and registries. Story Protocol is essentially an IP registry for the world. Let's walk through a conceptual code example of how you might register a piece of IP and its derivative using a hypothetical Story Protocol SDK.
Step 1: Defining Your IP Asset
First, you need to register your base creation. This could be a novel, a character design, or a piece of music. The protocol creates an on-chain representation of this IP.
JavaScript
import { StoryProtocol } from '@story-protocol/sdk';
const story = new StoryProtocol(signer);
async function registerBaseIP() {
const novel = {
title: "Chronicles of the Abstract Chain",
author: "your_wallet_address",
contentHash: "ipfs://CID_of_your_manuscript"
};
try {
// Registering the IP returns a unique on-chain identifier
const ipAsset = await story.register(novel);
console.log(`Successfully registered IP! Asset ID: ${ipAsset.id}`);
return ipAsset.id;
} catch (err) {
console.error("Registration failed:", err);
}
}
Step 2: Registering a Derivative Work
Now, imagine another creator wants to write a screenplay based on your novel. They can register their screenplay as a new IP Asset that is explicitly linked to yours.
JavaScript
async function registerDerivative(parentIpId) {
const screenplay = {
title: "Chronicles of the Abstract Chain: The Movie",
author: "screenwriter_wallet_address",
contentHash: "ipfs://CID_of_the_screenplay",
// This is the key part: linking to the parent IP
derivatives: {
source: parentIpId,
license: "LICENSE_AGREEMENT_ID" // Link to an on-chain license
}
};
try {
const derivativeAsset = await story.register(screenplay);
console.log(`Successfully registered derivative IP! Asset ID: ${derivativeAsset.id}`);
} catch (err) {
console.error("Registration failed:", err);
}
}
// Usage
const parentId = await registerBaseIP();
await registerDerivative(parentId);
The underlying Protocol, run by a network of Nodes, now has an immutable record of this relationship. This allows for automated revenue sharing and perfect attribution. For the official SDKs and more detailed guides, check out the official community documentation. It is the definitive Guide for developers.
Top comments (0)