Skip to main content

Mint an NFT

Minting an NFT refers to creating a unique and indivisible digital asset on the Tangle. When you mint an NFT, you usually associate a digital file, such as artwork, music, or video, with a specific token on the Tangle, establishing its authenticity, ownership, and uniqueness. This is done by assigning metadata to the NFT, including details about the creator (or issuer), the asset's description, and any additional information relevant to its value or characteristics.

Example Code

  1. Instantiate a Wallet, get Alice's Account which was created in the first guide and sync it.
  2. Define the sender_address as the first Address in the Account.
sdk/examples/how_tos/nfts/mint_nft.rs
loading...
  1. Create a new MintNftParams and set its values. Note that these include setting the sender and the issuer.
sdk/examples/how_tos/nfts/mint_nft.rs
loading...
  1. Mint the NFTs using the Account.mint_nfts() function.
sdk/examples/how_tos/nfts/mint_nft.rs
loading...
  1. Build the outputs for the transaction to mint another NFT using the NftOutputBuilder.
sdk/examples/how_tos/nfts/mint_nft.rs
loading...
  1. Send the transaction using the Account.send_outputs() function.
sdk/examples/how_tos/nfts/mint_nft.rs
loading...

Full Example Code

sdk/examples/how_tos/nfts/mint_nft.rs
loading...

Expected Output

Transaction sent: 0x4890a22c8c06a55d0e28b00d7a684c2a25479ae02b644824a5930ff059418280
Block included: https://explorer.shimmer.network/testnet/block/0xa7e1459879b7a4114b505ad2c5c67bf62b98b13a5ba530018c928530af873c3b
Minted NFT 1
Transaction sent: 0x308078cfd811fb99621e51791a431c6a306a077aceb99df6409188c61a27f372
Block included: https://explorer.shimmer.network/testnet/block/0xa020b148abdeeb94256e4f78dd4e3d623420fd233e0bbf7c20f64fd53d4f4b8d
Minted NFT 2