In this quickstart, you will:

  • Register a book series as an IP collection
  • Register a book as an IP asset
This quickstart is under development as new features are added to the Story Protocol daily.

Preparation Steps

1

Create a Developer Account and Project

To get started, create a developer account in the Crossmint Staging Console. Open that link, sign in, and accept the dialog to continue.

Crossmint offers two consoles: staging, for development and testing, and www, for production.

Then, navigate to project Settings > General and set the wallet type to “Smart Wallets”:

2

Get an API Key

Create a server-side API key with these scopes: collection.create, collection.update, collection.read, nfts.create.

This allows your API key to perform any kind of asset registration action.

Register a Book Series

1

Create an IP Collection

This quickstart will register the Harry Potter book series as an IP collection.

const response = await fetch("https://staging.crossmint.com/api/v1/ip/collections", {
    method: "POST",
    headers: {
        "X-API-KEY": "<YOUR_API_KEY>",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        metadata: {
            description: "The collection of Harry Potter books",
            name: "Harry Potter Series",
            symbol: "HP"
        }
    })
});

const collection = await response.json();
console.log("Collection created:", collection);

Customize the collection’s metadata according to your needs and run the script:

npx tsx createCollection.ts

Register a Book

1

Register an IP Asset

Every written work may have different contributors and metadata. When defining an IP asset you can:

  • Specify multiple contributors (like authors, illustrators, and publishers) with their respective revenue shares
  • Attach relevant media files
  • Include important metadata like creation dates and identifiers
const response = await fetch("https://staging.crossmint.com/api/v1/ip/collections/{collectionId}/ipassets", {
    method: "POST",
    headers: {
        "X-API-KEY": "<YOUR_API_KEY>",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        owner: 'email:creator@example.com',
        nftMetadata: {
            name: 'Art #123',
            description: 'A unique story NFT',
            image: 'https://example.com/nft/123.png'
        },
        ipAssetMetadata: {
            title: 'Harry Potter and the Philosopher\'s Stone',
            createdAt: '1997-06-26T00:00:00',
            ipType: 'literature',
            creators: [
                {
                    name: 'JK Rowling',
                    email: 'email:JKRowling@example.com',
                    description: 'Author',
                    contributionPercent: 80,
                    socialMedia: [
                        {
                            platform: 'Wikipedia',
                            url: 'https://en.wikipedia.org/wiki/J._K._Rowling'
                        }
                    ]
                },
                {
                    name: 'Thomas Taylor',
                    email: 'email:ThomasTaylor@example.com',
                    description: 'Illustrator',
                    contributionPercent: 15
                },
                {
                    name: 'Bloomsbury Publishing',
                    email: 'email:BloomsburyPublishing@example.com',
                    description: 'Publisher',
                    contributionPercent: 5,
                    socialMedia: [
                        {
                            platform: 'Website',
                            url: 'https://www.bloomsbury.com/'
                        }
                    ]
                }
            ],
            media: [
                {
                    name: 'ePub',
                    url: 'link_to_epub',
                    mimeType: 'application/epub+zip'
                },
                {
                    name: 'Book Summary PDF',
                    url: 'link_to_book_summary_pdf',
                    mimeType: 'application/pdf'
                }
            ],
            attributes: [
                {
                    key: 'ISBN',
                    value: '978-0-7475-3269-0'
                },
                {
                    key: 'Genre',
                    value: 'Fantasy'
                }
            ]
        }
    })
});

const ipAsset = await response.json();
console.log("IP Asset:", ipAsset);

Now, run the script:

npx tsx registerIPAsset.ts

Confirm Book Registration

1

Get Action Status

You can easily check the IP asset registration status to ensure the action has completed before proceeding.

const response = await fetch("https://staging.crossmint.com/api/v1/ip/actions/{actionId}", {
    method: "GET",
    headers: {
        "X-API-KEY": "<YOUR_API_KEY>",
        "Content-Type": "application/json"
    }
});

const action = await response.json();
console.log("Action:", action);

Use the action ID returned in any of the previous steps and run the script:

npx tsx getAction.ts