Burn an NFT
In this guide we will go through the process of burning an NFT
What are NFTs?
NFT, or non-fungible token, refers to a distinctive digital asset typically constructed on blockchain platforms. Unlike cryptocurrencies like Bitcoin or Ethereum, which are interchangeable and have identical values, NFTs are unique and cannot be duplicated or swapped for other assets. This characteristic makes them well-suited for representing digital assets such as art, collectibles, or other exclusive items.
NFTs are commonly established using the ERC721 standard on the Ethereum blockchain. This standard outlines a set of regulations and functions that an NFT contract must adhere to, enabling different NFTs to be compatible and easily traded. Additionally, the concept of ERC1155 has also gained prominence in the blockchain community. ERC1155 is a more advanced token standard that allows for creating fungible and non-fungible tokens within the same smart contract.
This has led to the development of more efficient and cost-effective ways of managing and trading multiple tokens on the blockchain. Our NFT API deploys our battle-tested ERC1155 Contracts, allowing you to enjoy its functionality to its fullest potential.
Several popular applications for NFTs include collecting and exchanging digital art, generating distinctive in-game items for video games, and authenticating ownership of tangible assets like real estate or luxury goods.
For token creation we support ERC1155 for most of the chains, except for IMX which uses ERC721
Reasons for Burning an NFT
An NFT can’t be ‘deleted’, however, it can be ‘burned’. Once an NFT is minted or uploaded to the
blockchain, it is considered immutable; this means it will exist on the blockchain forever. An NFT
can be ‘burned’ by being sent to an inaccessible address, as it is removed from circulation.
There exist various justifications for the desire to burn an NFT (non-fungible token). Some potential explanations encompass:
- Disposing of an unwanted or unnecessary NFT: If in possession of an NFT that is no longer desirable or required, burning serves as a means to permanently eliminate it from circulation. This action proves beneficial, particularly when the NFT occupies unnecessary space on the blockchain or when ensuring its non-utilization by any other party in the future is crucial.
- Demonstrating ownership of an NFT: In specific instances, burning an NFT can serve as proof of ownership. For instance, when an NFT symbolizes a physical asset, such as artwork or a collectible, incinerating the NFT serves as evidence of ownership over the physical asset and the right to dispose of it.
- Diminishing the supply of a specific NFT: Occasionally, burning an NFT aids in reducing its overall supply, potentially driving up its value. For example, if a limited quantity of a particular NFT is accessible, burning some of them heightens the scarcity of the remaining NFTs, thereby potentially enhancing their value.
- Engaging in creative expression: Some individuals opt to burn NFTs as a form of artistic expression. For instance, an artist might create an NFT and subsequently incinerate it as part of a performance or installation. In this context, the act of burning the NFT constitutes an artistic expression in itself.
On the whole, the decision to burn an NFT is a personal choice, contingent upon individual circumstances and objectives bound to your actual use case. It is crucial to thoroughly contemplate the implications of this irreversible action before proceeding.
The owner of the token has the right to burn it.
How to burn an NFT?
To burn an NFT, the wallet that owns the NFT needs to execute the burn
function on the NFT Contract.
When creating the Token Type it has to be created as "burnable": true, such a parameter is defined upon creation and cannot be updated afterwards.
Requirements:
ID
of the wallet that holds the NFT- The public wallet
address
that holds the NFT - Token
ID
that is to be burned Contract address
of the NFT
As input parameters of the burn function we have:
id
: Token ID of the NFT that will get burned- account (
address
): Wallet address where the NFT is held amount
: Number of tokens to be burned, in case of an ERC1155 token
Following the documentation, we can see the burn
function:
To call the burn
function on the contract, we have to prepare the endpoint for that. We will do it at a later stage.
For this guide, we have a wallet that owns a specific NFT. To list the NFTs for a given Wallet ID
, we can use the endpoint to list the NFTs , this way we can corroborate the whole process.
We can use the endpoint to list the NFTs, then we can choose from the list the NFT we want to burn.
More importantly, from the response we will fetch the Token ID
and the Contract Address
of the NFT, both required parameters to call the burn
function.
Let’s do this step by step.
1. List the NFTs for a wallet
Call the following endpoint to list all NFTs held in the wallet:
Request Endpoint: reference
GET /api/wallets/{walletId}/nonfungibles
Path Variables:
walletId
: This is the ID of a wallet.
Response Body:
From here we choose the NFT that will be burned, thus, we take the required parameters for the
burn
function:
- result.
id
: This is the token ID of the NFT- result.contract.
address
: This is the contract address of the NFT
{
"success": true,
"result": [
{
"id": "68",
"name": "Test NFT that will be burned",
"animationUrls": [],
"fungible": false,
"contract": {
"name": "Venly",
"description": "Example contract created using the VENLY NFT API Mauro created it",
"address": "0x750d09e481ece126e0e9902d4bc546a6968b5b4a",
"symbol": "VE",
"media": [
{
"type": "image",
"value": "https://lh3.googleusercontent.com/jCPj6BmSaq63HFJ1WdRQ8QbJCDYW_FcUCEQ_2_OPe4p9aZpveDXJEoi8jJnPDbM18dtVt3CoUIHn1tMSewCdcwfuef1sSlw-Ow"
}
],
"type": "ERC_1155",
"verified": false,
"premium": false,
"categories": [],
"url": "https://venly.io",
"imageUrl": "https://lh3.googleusercontent.com/jCPj6BmSaq63HFJ1WdRQ8QbJCDYW_FcUCEQ_2_OPe4p9aZpveDXJEoi8jJnPDbM18dtVt3CoUIHn1tMSewCdcwfuef1sSlw-Ow"
},
"attributes": [
{
"type": "property",
"name": "Token Type ID",
"value": "67"
},
{
"type": "property",
"name": "Max Supply",
"value": "10"
}
],
"balance": 1,
"finalBalance": 1,
"transferFees": false
}
]
}
Now you should have the following:
- Token
ID
of the NFT- Contract
address
of the NFT- Wallet
ID
that holds the NFT- Public wallet
address
that holds the NFT
2. Burn
Now we need to prepare the execute function to call the burn function as follows:
Request Endpoint: reference
GET /api/transactions/execute
Parameter | Param Type | Value | Description |
---|---|---|---|
Signing-Method | Header | id:value | id : This is the ID of the signing methodvalue : This is the value of the signing method |
Request Body:
Parameter | Description | Data Type | Mandatory? |
---|---|---|---|
transactionRequest.type | This will be CONTRACT_EXECUTION | String | ✅ |
transactionRequest.walletId | The ID of the wallet holding the NFT | String | ✅ |
transactionRequest.to | The contract address of the NFT | String | ✅ |
transactionRequest.secretType | The blockchain of the NFT (in this case, its MATIC ) | String | ✅ |
transactionRequest.functionName | This will be burn | String | ✅ |
transactionRequest.inputs | An array of inputs for the burn function (see example below) | Array | ✅ |
{
"transactionRequest": {
"type": "CONTRACT_EXECUTION",
"walletId": "a1a72692-ca76-4579-9ad3-bf18af625f10",
"to": "0x750d09e481ece126e0e9902d4bc546a6968b5b4a",
"secretType": "MATIC",
"functionName": "burn",
"inputs": [
{
"type": "uint256",
"value": "68" //This is the token ID
},
{
"type": "address",
"value": "0xcDBfaDa367f1B19a3db9DD01f67F43AB99dcB762" // This is the wallet address holding the NFT
},
{
"type": "uint256",
"value": "1" //The number of NFTs to burn
}
]
}
}
Once we have called the burn function using the execute endpoint, we can corroborate if it was burned by listing the NFTs owned by the wallet as shown above. We will not see it listed.
3. Burn Batch (Burn multiple NFTs at once)
Last but not least, we can burn multiple tokens at once for the NFT Contracts that were created using ERC1155. To do so, instead of the burn
function, we need to call burnbatch
, as shown in here.
The burnBatch
function uses Arrays
as an input parameter for id
and amount
.
The NFTs have to be from the same contract address in order to batch burn them all.
As input parameters of the burn function we have:
ids
: Token ID's of the NFT that will get burned- account (
address
): Wallet address where the NFTs are held amounts
: Number of tokens to be burned, in case of an ERC1155 token
Call the following endpoint to burn multiple NFTs together.
Request Endpoint: reference
GET /api/transactions/execute
Parameter | Param Type | Value | Description |
---|---|---|---|
Signing-Method | Header | id:value | id : This is the ID of the signing methodvalue : This is the value of the signing method |
Request Body:
Parameter | Description | Data Type | Mandatory? |
---|---|---|---|
transactionRequest.type | This will be CONTRACT_EXECUTION | String | ✅ |
transactionRequest.walletId | The ID of the wallet holding the NFT | String | ✅ |
transactionRequest.to | The contract address of the NFT | String | ✅ |
transactionRequest.secretType | The blockchain of the NFT (in this case, its MATIC ) | String | ✅ |
transactionRequest.functionName | This will be burnBatch | String | ✅ |
transactionRequest.inputs | An array of inputs for the burn function (see example below) | Array | ✅ |
{
"transactionRequest": {
"type": "CONTRACT_EXECUTION",
"walletId": "a400142a-77b1-4cfa-87cd-7efbd599294d",
"to": "0xe42256f396710cba4d5efb3800d21092afaf2d48",
"secretType": "MATIC",
"functionName": "burnBatch",
"inputs": [
{
"type": "uint256[]",
"value": "[101,103,105,107,109]" //These are the token ID's
},
{
"type": "address",
"value": "0x2c5092A1968F3f261010dA53bD70f4543D4a0c35" //This is the contract address of the NFTs
},
{
"type": "uint256[]",
"value": "[1,1,1,1,1]" //These are the amount of tokens you want to burn
}
]
}
}
Updated 3 months ago