Learn how to register, protect, and monetize Stability AI-Generated images on Story.
In this tutorial, you will learn how to:
Let’s say you generate an image using Stability 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 Stability AI-Generated image so that if others want to use it, they must properly license it from you.
There are a few steps you have to complete before you can start the tutorial.
.env
file:.env
file:.env
file:Stability Credits
In order to generate an image, you’ll need Stability 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
file. You can just use the public default one we provide:You can follow the Stability API Reference to use the model of your choice. For this tutorial, we’ll be using Stability’s Stable Image Core generate endpoint to generate an image. The below is taken directly from their documentation.
Create a main.ts
file and add the following code:
Stability generates images that are heavy in size, and therefore expensive to store. Optionally, we can condense the produced image for faster loading speeds and less expensive storage costs.
Now that we have our image, we need to store it on IPFS so we can get a URL back to access it. In this tutorial we’ll be using Pinata, a decentralized storage solution that makes storing images easy.
In a separate file uploadToIpfs.ts
, create a function uploadBlobToIPFS
that uploads our buffer to IPFS:
Back in the main file, call the uploadBlobToIPFS
function to store our image:
Now that we have generated and stored our image, we can register the image as IP on Story. First, let’s set up our config. In a utils.ts
file, add the following code:
Associated docs: TypeScript SDK Setup
View the IPA Metadata Standard and construct the metadata for your IP. Properly format your metadata as shown below:
The NFT Metadata follows the ERC-721 Metadata Standard.
In the uploadToIpfs.ts
file, create a function to upload your IP & NFT Metadata objects to IPFS:
You can then use that function to upload your metadata, as shown below:
When registering your image on Story, you can attach License Terms to the IP. These are real, legally binding terms enforced on-chain by the Licensing Module, disputable by the Dispute Module, and in the worst case, able to be enforced off-chain in court through traditional means.
Let’s say we want to monetize our image such that every time someone wants to use it (on merch, advertisement, or whatever) they have to pay an initial minting fee of 10 $WIP. Additionally, every time they earn revenue on derivative work, they owe 5% revenue back as royalty.
Next we will mint an NFT, register it as an IP Asset, set License Terms on the IP, and then set both NFT & IP metadata.
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
.
Creating your own custom ERC-721 collection
Using the 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:
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.Associated Docs: ipAsset.mintAndRegisterIp
Congratulations! Now your image is registered on Story with commercial license terms.
Learn how to register, protect, and monetize Stability AI-Generated images on Story.
In this tutorial, you will learn how to:
Let’s say you generate an image using Stability 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 Stability AI-Generated image so that if others want to use it, they must properly license it from you.
There are a few steps you have to complete before you can start the tutorial.
.env
file:.env
file:.env
file:Stability Credits
In order to generate an image, you’ll need Stability 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
file. You can just use the public default one we provide:You can follow the Stability API Reference to use the model of your choice. For this tutorial, we’ll be using Stability’s Stable Image Core generate endpoint to generate an image. The below is taken directly from their documentation.
Create a main.ts
file and add the following code:
Stability generates images that are heavy in size, and therefore expensive to store. Optionally, we can condense the produced image for faster loading speeds and less expensive storage costs.
Now that we have our image, we need to store it on IPFS so we can get a URL back to access it. In this tutorial we’ll be using Pinata, a decentralized storage solution that makes storing images easy.
In a separate file uploadToIpfs.ts
, create a function uploadBlobToIPFS
that uploads our buffer to IPFS:
Back in the main file, call the uploadBlobToIPFS
function to store our image:
Now that we have generated and stored our image, we can register the image as IP on Story. First, let’s set up our config. In a utils.ts
file, add the following code:
Associated docs: TypeScript SDK Setup
View the IPA Metadata Standard and construct the metadata for your IP. Properly format your metadata as shown below:
The NFT Metadata follows the ERC-721 Metadata Standard.
In the uploadToIpfs.ts
file, create a function to upload your IP & NFT Metadata objects to IPFS:
You can then use that function to upload your metadata, as shown below:
When registering your image on Story, you can attach License Terms to the IP. These are real, legally binding terms enforced on-chain by the Licensing Module, disputable by the Dispute Module, and in the worst case, able to be enforced off-chain in court through traditional means.
Let’s say we want to monetize our image such that every time someone wants to use it (on merch, advertisement, or whatever) they have to pay an initial minting fee of 10 $WIP. Additionally, every time they earn revenue on derivative work, they owe 5% revenue back as royalty.
Next we will mint an NFT, register it as an IP Asset, set License Terms on the IP, and then set both NFT & IP metadata.
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
.
Creating your own custom ERC-721 collection
Using the 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:
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.Associated Docs: ipAsset.mintAndRegisterIp
Congratulations! Now your image is registered on Story with commercial license terms.