Burn NFT
When you burn an NFT, you permanently remove it from the ledger state, rendering it unusable and nontransferable. The associated storage deposit will automatically be returned to its original account.
irreversible
Burning an NFT is irreversible and signifies the destruction of its digital representation and associated ownership rights.
Example Code
- Rust
- Typescript (Node.js)
- Python
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Set the
nft_id
as the first NFT in the balance.
- Burn the NFT by calling the
Account.burn()
function.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Set
nftId
as the first NFT Id in the balance and display the balance.
- Prepare the transaction that will burn the NFT by calling the
Account.prepareBurnNft()
function and send the transaction using theAccount.send()
function.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Set
nftId
as the first NFT Id in the balance and display the balance.
- Prepare the transaction that will burn the NFT by calling the
Account.prepare_burn_nft()
function and send the prepared transaction using theAccount.send()
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/nfts/burn_nft.rs
loading...
bindings/nodejs/examples/how_tos/nfts/burn_nft.ts
loading...
bindings/python/examples/how_tos/nfts/burn_nft.py
loading...
Expected Output
Transaction sent: 0xed7955f0c2d1a1e267b61b0a1859b58a9b5112385c18feae1a198f3a9992d19e
Block included: https://explorer.shimmer.network/testnet/block/0x1c4fe528677089eeffaa01eefe34eda4a75f7c6f2020d83af61221571979f616
Burned NFT 0xd2356323fad25efa3ec772a341d122eaf5ea3bf1cba48b70a1038b7d00bc385d