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
- Rust
- Typescript (Node.js)
- Python
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Define the
sender_address
as the firstAddress
in theAccount
.
- Create a new
MintNftParams
and set its values. Note that these include setting the sender and the issuer.
- Mint the NFTs using the
Account.mint_nfts()
function.
- Build the outputs for the transaction to mint another NFT using the
NftOutputBuilder
.
- Send the transaction using the
Account.send_outputs()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Define the
senderAddress
as the firstAddress
in theAccount
.
- Create a new
MintNftParams
and set its values. Note that these include setting the sender and the issuer.
- Create the transaction that will mint the NFTs using the
Account.mintNfts()
function.
- Build the outputs for the transaction to mint another NFT using the
Client.buildNftOutput()
function and send the transaction using theAccount.sendOutputs()
function.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Create a new
MintNftParams
and set its values.
- Prepare the transaction that will mint the NFT using the
Account.prepare_mint_nfts()
function and send the prepared transaction using theAccount.send()
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/nfts/mint_nft.rs
loading...
bindings/nodejs/examples/how_tos/nfts/mint_nft.ts
loading...
bindings/python/examples/how_tos/nfts/mint_nft.py
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