Tangocrypto
Search
⌃K

Royalties

How to creat NFT collections with royalties

Royalties allow creators to earn a percentage of the sale price each time an NFT is sold on a marketplace. In Cardano royalties are implemented using metadata only, and does not require a smart contract.We follow CIP27 to define royalties in the collections. If you want to know more about CIP27 follow this link.
We define the following input parameters:
  • Royalty address: Wallet address receiving the royalty payments.
  • Royalty percentage: Percentage of the sale price earned each time your NFT creation is sold on a marketplace. It can be any floating point value from 0.0 to 1.0, representing between 0 and 100 per cent. For example, 0.05 means 5%.

Important

To have royalties on your collection, you must mint the royalty token before minting the first NFT. You must mint the royalty token and pay the transaction fee (~0.18 ADA). Take into consideration that any future updates or rewrites will be ignored. This prevents the collection's creator from changing the royalties at a future date.
A royalty token will live forever in the blockchain; therefore, you can't change the percentage or the wallet receiving the payments. Make sure you can access that wallet and save the seed phrase property.

Example

In this example we are going to create a 5% royalty for the collection.
HTTP
Axios (JS)
cURL
Create a collection with %5 royalty.
POST /<app-id>/v1/nft/collections HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <x-api-key>
Content-Type: application/json
Content-Length: 1226
{
"name": "Royalty Collection",
"description": "Royalty description",
"url": "https://www.royalty.io",
"payout_address": "addr_test1qp9mj7vnenx4v99hw7ztfq03n7dmmujpgtlyfjhhel9w67nk72usllcew208n60ym94xcptfrgytuy5apwp565x28jgsg0ztq3",
"policy": {
"lock": true,
"lock_time": "2024-04-30T00:00:00.000Z"
},
"metadata": {
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"color": "<color>",
"body": "<body>",
"eyes": "<eyes>",
"face": "<face>",
"accessory": "<accessory>",
"collection": "Demo1 Collection",
"artist": "Demo1",
"twitter": "https://twitter.com/demo1_io",
"copyright": "Demo1 2021"
},
"version": "1.0"
},
"royalty": {
"address": [
"addr_test1qphrtw0qqz2c0vvpu0qdhdh95cne39xmur4kk4npqmec4q05xrj744",
"ghaug2yrd7e2g8d0k2zsp4g56pscuetpmuw78qwpcgy7"
],
"rate": 0.05
}
}
Create a collection with %5 royalty.
var axios = require('axios');
var data = JSON.stringify({
"name": "Royalty Collection",
"description": "Royalty description",
"url": "https://www.royalty.io",
"payout_address": "addr_test1qp9mj7vnenx4v99hw7ztfq03n7dmmujpgtlyfjhhel9w67nk72usllcew208n60ym94xcptfrgytuy5apwp565x28jgsg0ztq3",
"policy": {
"lock": true,
"lock_time": "2024-04-30T00:00:00.000Z"
},
"metadata": {
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"color": "<color>",
"body": "<body>",
"eyes": "<eyes>",
"face": "<face>",
"accessory": "<accessory>",
"collection": "Demo1 Collection",
"artist": "Demo1",
"twitter": "https://twitter.com/demo1_io",
"copyright": "Demo1 2021"
},
"version": "1.0"
},
"royalty": {
"address": [
"addr_test1qphrtw0qqz2c0vvpu0qdhdh95cne39xmur4kk4npqmec4q05xrj744",
"ghaug2yrd7e2g8d0k2zsp4g56pscuetpmuw78qwpcgy7"
],
"rate": 0.05
}
});
var config = {
method: 'post',
url: 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections',
headers: {
'x-api-key': '<x-api-key>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Create a collection with %5 royalty.
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections' \
--header 'x-api-key: <x-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Royalty Collection",
"description": "Royalty description",
"url": "https://www.royalty.io",
"payout_address": "addr_test1qp9mj7vnenx4v99hw7ztfq03n7dmmujpgtlyfjhhel9w67nk72usllcew208n60ym94xcptfrgytuy5apwp565x28jgsg0ztq3",
"policy": {
"lock": true,
"lock_time": "2024-04-30T00:00:00.000Z"
},
"metadata": {
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"color": "<color>",
"body": "<body>",
"eyes": "<eyes>",
"face": "<face>",
"accessory": "<accessory>",
"collection": "Demo1 Collection",
"artist": "Demo1",
"twitter": "https://twitter.com/demo1_io",
"copyright": "Demo1 2021"
},
"version": "1.0"
},
"royalty": {
"address": [
"addr_test1qphrtw0qqz2c0vvpu0qdhdh95cne39xmur4kk4npqmec4q05xrj744",
"ghaug2yrd7e2g8d0k2zsp4g56pscuetpmuw78qwpcgy7"
],
"rate": 0.05
}
}'
Response
{
"id": "01g9e0edf52pem1yf7m0r46k37",
"name": "Royalty Collection",
"url": "https://www.royalty.io",
"description": "Royalty description",
"network": "testnet",
"payout_address": "addr_test1qp9mj7vnenx4v99hw7ztfq03n7dmmujpgtlyfjhhel9w67nk72usllcew208n60ym94xcptfrgytuy5apwp565x28jgsg0ztq3",
"token_count": 0,
"token_for_sale_count": 0,
"token_sold_count": 0,
"sales_count": 0,
"revenue": 0,
"income": 0,
"service_fee": 0,
"nft_fee": 0,
"tx_fee": 0,
"total_fees": 0,
"policy": {
"lock": true,
"lock_time": "2024-04-30T00:00:00.000Z",
"policy_id": "65cd0f3cd78b00cf11e3b45289eed0569e205990d1491fcbf440b959",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "a387745bdf00390cc6a33f1a3ac85d91901b3e04b44b07d1e7a6771a"
},
{
"type": "before",
"slot": 120065902
}
]
}
},
"metadata": {
"label": "721",
"asset_name": "<asset_name>",
"name": "<name>",
"image": "<image_link>",
"media_type": "<mime_type>",
"description": "<description>",
"attributes": {
"color": "<color>",
"body": "<body>",
"eyes": "<eyes>",
"face": "<face>",
"accessory": "<accessory>",
"collection": "Demo1 Collection",
"artist": "Demo1",
"twitter": "https://twitter.com/demo1_io",
"copyright": "Demo1 2021"
},
"version": "1.0"
},
"royalty": {
"metadata": {
"777": {
"addr": [
"addr_test1qphrtw0qqz2c0vvpu0qdhdh95cne39xmur4kk4npqmec4q05xrj744",
"ghaug2yrd7e2g8d0k2zsp4g56pscuetpmuw78qwpcgy7"
],
"rate": "0.05"
}
}
},
"payment_link": "https://buy.tangocrypto.com?q=test_eyJjb2xsZWN0aW9uX2lkIjoiMDFnOWUwZWRmNTJwZW0xeWY3bTByNDZrMzciLCJwcmljZSI6MjE4NjU5MywicmVzZXJ2YXRpb25fdGltZSI6MzAwLCJzdXBwbHkiOjEsImFzc2V0X25hbWUiOiJSb3lhbHR5IFRva2VuIiwicXVhbnRpdHkiOjEsInJ1bGVzIjpbXSwidHlwZSI6IlJveWFsdHlTYWxlIiwiaXNfcmFuZG9tIjpmYWxzZSwidGl0bGUiOiJSb3lhbHR5NiBDb2xsZWN0aW9uIiwidGNjIjoicVgrcGdJUm00Qm5iVVR2UnFzeGtlYkQyQUtwekJpdE15MlQ3MStIUWhwcVZKMVhkcmo1bHNPVjJBeTFyT3YvUUpRUEd6SFVVdm9BdEdPbU15dVlkZWlTWlBCYSsxQlJ1YnhiNXVNLzRBY2NzMys1SWxIa2t3aDdkVUZMVkFnPT0iLCJtYXhfdHhfZmVlIjo4NzYyNzcsIm5mdF9jb3N0IjozNDQ4Mn0=",
"created_at": "2022-08-02T00:49:12.662Z",
"updated_at": "2022-08-02T00:49:12.662Z"
}
When the collection is created with a royalty it returns a payment link to mint the royalty token. Copy the payment link and open it in a browser and mint the royalty token.
Pay the fees for the royalty token
Once the token is minted you'll see the confirmation.
Royalty token successfully purcased.
If you click on view item you'll see the transaction in Cardanoscan and the metadata minted on the blockchain.