Mint and burn NFTs with React.js
Use React.js to mint and burn NFTs on the XRP Ledger.
Representing unique assets on ledger
Normal tokens are great for representing fungible assets like fiat currencies. Still, sometimes you want to represent a non-fungible asset—for example, a car deed, a specific piece of art, or a credential. Non-Fungible Tokens (NFTs) allow you to tokenize those assets and use the XRPL to buy and sell them.
NFTs on the XRPL have a couple of necessary fields to note:
NFTokenTaxon – An arbitrary id used to group NFTs issued by the same account. If you’re creating a collection of similar assets, you can show them the same NFTokenTaxon.
URI – This optional field lets you link to more information related to your NFT. Some people use this to link to the asset the NFT is representing, and others use this to link to additional metadata to help parse the NFT in marketplaces or other applications.
The rest of this lesson will show you how to create (“mint”) an NFT, see which NFTs an account currently owns, and how to delete (“burn”) an NFT.
Seeing this in action
- Open the sandbox below.
- Wait for the wallets to be funded.
- Customize your NFT by adding a link, or small amount of text to the URI field.
– This field accepts a maximum of 256 bytes to keep the data stored on the ledger to a reasonable size.
– This typically is where links to digital content or metadata would be stored.
- Click the Send button to mint your NFT, and wait for your NFTokenMint transaction to be validated by the XRPL.
- If it succeeds, you should see a token ID in your account, along with the URI you included.
– You can repeat this using different URIs to see more NFTs get added to your account.
- Copy and paste one NFTokenID and paste it into the “burn” field.
- Click the Send button to delete that NFToken permanently.
– Behind the scenes, this sends an NFTokenBurn transaction.