Skip to main content
BETA
HomeIntegration BuilderAPI ReferenceGuides
View Mirror World on Github
Join the Discord server

How are NFT royalties distributed in Solana?

By Jonathan Bakebwa

How are NFT royalties distributed in Solana?

Introduction to NFTs

NFTs, or non-fungible tokens, are unique digital assets that represent ownership of a specific item or idea. One popular use case for NFTs is in the art and collectibles market, where creators can mint and sell unique digital works to collectors.

In the Solana ecosystem, NFTs can include a feature called royalty distribution, which allows the creator of an NFT to earn a percentage of the sales price every time their NFT is resold. This can be useful for creators to continue earning income from their work even after the initial sale.

Royalty Distribution In Action

To implement royalty distribution in a Solana NFT, the creator must first set up a public key that will receive the royalty payments. This public key can be any valid Solana address, including a multi-sig address or a smart contract.

Mint stage

Once the creator has set up their public key or array of creator public keys, they can specify the percentage of the sales price that they want to receive as royalties. This percentage, defined by the seller_fee_basis_points field of the Metadata account of the NFT, is typically set at the time of minting the NFT, but it can also be modified later if desired.

When a collector buys an NFT with royalty distribution enabled, a small percentage of the sales price is set aside as the royalty payment. This payment is then sent to the creator's public key at the time of the sale.

Transaction stage

If the NFT is later resold to another collector, the process repeats itself. The new buyer pays a small percentage of the sales price as a royalty, which is then sent to the creator's public key. This process continues every time the NFT is resold, allowing the creator to earn income from their work continually.

Managing Royalties for NFT as a creator

It's important to note that the seller_fee_basis_points are first determined at the time of minting the NFT. However, it can be updated by the update authority of the NFT. This can easily be done through the Mirror World SDK in the steps shown below:

Initialize the Mirror World SDK


_7
import { MirrorWorld, ClusterEnvironment } from "@mirrorworld/web3.js"
_7
_7
// Initialize the SDK
_7
const mirrorworld = new MirrorWorld({
_7
apiKey: "YOUR_SECRET_API_KEY",
_7
env: ClusterEnvironment.testnet, // Can be ClusterEnvionment.mainnet for mainnet
_7
})

Prepare your Metadata

Your Metadata contains all the information about the NFT. Take note of the seller_fee_basis_points field of the sample metadata JSON provided below: In this NFT, it has been set to 425 points, which is equal to 4.25%.


_48
{
_48
"name": "Mirrors #15976",
_48
"symbol": "MIRROR",
_48
"description": "Mirror World is the World's First interoperable GameFi Matrix inhabited by AI NFTs. This is Mirror Generation 2 collection, which contains 3 factions: Vida, Xeon and Nova, and within each faction, Mirror can be minted in Common, Rare, Elite, Legendary and Mythical rarities, and these AI-Powered Assets can be used in the Mirror World Matrix.",
_48
"seller_fee_basis_points": 425,
_48
"image": "https://storage.mirrorworld.fun/nft/15976_vida_epic_953_f0875ffb53ac4463b1ce54e5545f396f.png",
_48
"external_url": "https://mirrorworld.fun",
_48
"attributes": [{
_48
"trait_type": "Rarity",
_48
"value": "Elite"
_48
}, {
_48
"trait_type": "Background",
_48
"value": "FORMC Suit-Background"
_48
}, {
_48
"trait_type": "Shoes",
_48
"value": "E-9 Suit-Shoes"
_48
}, {
_48
"trait_type": "Clothes",
_48
"value": "FORMC Suit-Clothes"
_48
}, {
_48
"trait_type": "Hat",
_48
"value": "E-9 Suit-Hat"
_48
}, {
_48
"trait_type": "Pants",
_48
"value": "SGM Suit-Pants"
_48
}, {
_48
"trait_type": "Soul",
_48
"value": "pmurT dlanoD"
_48
}, {
_48
"trait_type": "Faction",
_48
"value": "Vida"
_48
}],
_48
"collection": {
_48
"name": "Mirrors Gen 2",
_48
"family": "Mirrors"
_48
},
_48
"properties": {
_48
"category": "image",
_48
"files": [{
_48
"uri": "https://storage.mirrorworld.fun/nft/15976_vida_epic_953_f0875ffb53ac4463b1ce54e5545f396f.png",
_48
"type": "image/png"
_48
}],
_48
"creators": [{
_48
"address": "FU1tDd78JKyLqDT6jRUhgLkxdnuYu1Z9nJL2QfwjtWuv",
_48
"share": 100
_48
}]
_48
}
_48
}

Lastly upload your Metadata JSON to Decentralized Object Storage like IPFS, NFT.Storage or Pinata. You may also use a Centralized Object Storage service like AWS S3. Make sure to record the metadata object URI returned from your storage service of choice. We shall use it while minting the NFT.

Mint your NFT

When minting your NFT, set the metadataUri field of the MirrorWorld.mintNFT method to the value of the URI for your metadata JSON as shown below:


_8
async function mintMyNft() {
_8
await mirrorworld.mintNFT({
_8
name: `YOUR_NFT_NAME`,
_8
symbol: `NFT_SYMBOL`,
_8
metadataUri: "YOUR_NFT_METADATA_URI",
_8
collection: "YOUR_COLLECTION_ID",
_8
});
_8
}

Voila! Your minting is done, and the creator royalties are designated to your NFT!

Overall, the concept of NFT royalty distribution in the Solana ecosystem is useful for creators to continue earning income from their work even after the initial sale. By setting up a public key and specifying a percentage of the sales price as royalties, creators can ensure that they are compensated for the ongoing value of their work.

Learn More

Get started with the Mirror World Smart SDK by exploring our documentation to get started! Happy Hacking!

Edit this page on GitHub

Copyright © Mirror World, Inc. 2023
On this page

Home

Tutorials

Guides

API Reference