About NFTs
A non-fungible token (NFT) is a token that’s cryptographically unique and not interchangeable with any other. As tokens representing uniqueness, NFTs make useful tokens to represent assets with unique data which can’t be replicated or replaced.
NFTs on Polymesh
Polymesh introduced functionality for non-fungible tokens (NFTs) leveraging Polymesh’s sophisticated compliance, settlement, and portfolio management features.
Learn more about NFTs in our blog.
Create an asset with the Polymesh App
Before creating an NFT on Polymesh, a ticker, and an asset must be created first.
Prerequisites
- A verified Polymesh Account.
- Sufficient POLYX balance on the account to cover transaction and protocol fees.
Create an asset with the Polymesh App
- Open the Polymesh app - Testnet or Mainnet.
- For the account at the top, select your account in your wallet.
- For the extrinsic, select asset, then createAsset, as per the below screenshot:
Click here to see this image at full resolution. -
Asset Name: Enter an asset name.
-
Divisible: Select “Yes” or “No”.
Please note: Once a divisible token is distributed, you cannot change it to be indivisible. However, if a token is initially indivisible, it can be changed to be a divisible token at any time. - Asset Type: Select NonFunglible from the drop-down.
- NonFungible: Select a type for the NFT asset from the drop-down.
Click here to see this image at full resolution. - Asset Identifier: You can add a Security Identifier by clicking on the “Add item” button below the Asset Type field. The Security Identifier should be in its original format.
- Funding Round: To enter the Funding Round, click on the “include option” toggle to make it available.
Click here to see this image at full resolution. - Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
You can find more information on How to create an asset with the Polymesh App.
Register NFT Metadata
NFTs can be associated with metadata at both the collection and individual NFT granularity. Each NFT collection can define local metadata keys to use for their collection.
There are also 4 globally defined metadata keys, which are intended to be used in a standardized way, to allow third-party dApps etc. to easily process metadata associated with NFTs.
All metadata keys must be registered before the creation of the NFT collection.
You can find more info in the documentation of the Metadata schema.
Register Global Metadata
- Open the Polymesh app - Testnet or Mainnet.
- Select the key you want to sign the transaction.
- For the extrinsic, select asset then registerAssetMetadataGlobalType then fill in the data as per below:
Click here to see this image at full resolution. -
name: This is the name of the metadata. The following data can be set optionally:
- spec: Metadata type definition.
- url: URL of the metadata.
- description: Description of the metadata.
-
typeDef: type definition of the Metadata .
Click here to see this image at full resolution.
-
Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
Register Local Metadata
- Open the Polymesh app - Testnet or Mainnet.
- Select the key you want to sign the transaction.
- For the extrinsic, select asset then registerAssetMetadataLocalType then fill in the data as per below:
Click here to see this image at full resolution. -
ticker: Enter the ticker you registered in the previous step in HEX format.
-
name: This is the name of the metadata. The following data can be set optionally:
- spec: Metadata type definition.
- url: URL of the metadata.
- description: Description of the metadata.
-
typeDef: type definition of the Metadata
Click here to see this image at full resolution.
-
Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
Create an NFT Collection with the Polymesh App
All non-fungible tokens are linked to a unique NFT collection, which is tied to an Asset and user-defined metadata.
- Open the Polymesh app - Testnet or Mainnet
- Select the key you want to sign the transaction.
- For the extrinsic, select nft then createNfTCollection.
-
ticker: This is the ticker associated with the new NFT collection and created in the previous step. Enter the ticker name in HEX format.
Click here to see this image at full resolution. -
nftType: This is the type of the NFT collection. Click on the "include option" toggle to enable it, then select a type for the NFT collection.
-
collection keys: Define all mandatory metadata keys that the tokens in the collection must have. Either Local or Global keys can be assigned to the NFT collection here.
You can add or remove items by clicking on the respective button on the right side:
Click here to see this image at full resolution. -
Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
Possible errors and solutions
- CollectionAlredyRegistered: if the ticker is already associated with an NFT collection. Enter a different ticker.
- InvalidAssetType: if the associated asset is not of type NFT. The asset type must be NonFungible.
- MaxNumberOfKeysExceeded: if the number of metadata keys for the collection is greater than the maximum allowed. The number of metadata keys associated with the collection must be less or equal to MaxNumberOfCollectionKeys.
- UnregisteredMetadataKey: if any of the metadata keys needed for the collection have not been registered. All metadata keys must be registered before creating an NFT collection.
- DuplicateMetadataKey: if a duplicate metadata key has been passed as input. Verify the correct metadata keys.
Issue an NFT with the Polymesh App
- Open the Polymesh app - Testnet or Mainnet.
- Select the key you want to sign the transaction.
- For the extrinsic, select nft > issueNft then fill in the data as per below:
Click here to see this image at full resolution. -
ticker: This is the ticker associated with the NFT collection that has been created prior. Enter the ticker of the NFT Collection in HEX format.
Click here to see this image at full resolution.
Note: Use a HEX converter like this one. For the Output delimiter string, select "None".
Example: Your ticker name is "NFTTest", which is "4E465454657374" in HEX. This HEX value should be padded with zeros to be 24 bytes like "4E4654546573740000000" with a 0x prefix, so the value you should enter is "0x4E4654546573740000000".
Shorter ticker names than 12 characters in HEX should be also padded with zeros up to 12 characters. -
nft_metadata_attributes: This field includes all mandatory metadata keys and values for the NFT. Either Local or Global keys can be assigned to the NFT here.
You can add or remove items by clicking on the respective button on the right side:- key: It can be either Local or Global. Select one from the dropdown.
- Global/Local: Enter key for the metadata.
-
value: Enter a value for the key.
Click here to see this image at full resolution.
-
portfolio_kind: This is the portfolio that will receive the minted NFT. It can be either the Default portfolio or any User portfolio.
- Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
Possible issues and solutions
- CollectionNotFound: if the collection associated with the given ticker has not been created. Go back to the previous steps to create an NFT collection.
- InvalidMetadataAttribute: if the number of attributes is not equal to the number set in the collection or attempting to set a value for a key not defined in the collection. Verify the NFT metadata.
- DuplicateMetadataKey: if a duplicate metadata keys has been passed as input. Verify the NFT metadata.
Redeem an NFT with the Polymesh app
A non-fungible token can be redeemed anytime by its owner. Once redeemed, the non-fungible token will no longer be linked to the owner's portfolio.
- Open the Polymesh app - Testnet or Mainnet.
- Select the key you want to sign the transaction.
- For the extrinsic, select nft then redeemNft.
Click here to see this image at full resolution. - ticker: This is the ticker associated with the NFT collection that has been created prior. Enter the ticker of the NFT Collection in HEX format.
- id: Enter the ID of the NFT you would like to redeem.
-
portfolio: This is the portfolio that will redeem the NFT from. It can be either the Default portfolio or any User portfolio.
Click here to see this image at full resolution. - Once all data are filled, click on
Submit Transaction
then sign the transaction with your wallet.
View your NFTs on the Polymesh Portal
NFTs you own can be viewed on the Polymesh Portal's Portfolio page.
Scroll down to the bottom of the page to the Non-Fungible Assets section:
Alternatively, you can even see NFTs that are not in your portfolio, just need to identify the ticker of the NFT Collection and the individual NFT ID, then paste them to one of the URLs below:
- Collection view: https://portal.polymesh.network/portfolio?nftCollection=TICKER_OF_NFT_COLLECTION
- Individual NFT view: https://portal.polymesh.network/portfolio?nftCollection=TICKER_OF_NFT_COLLECTION&nftId=NFT_ID_NUMBER
Comments
0 comments
Please sign in to leave a comment.