Comment on page
Burn a token
Burns fungible and non-fungible tokens owned by the Treasury Account. If no Supply Key is defined, the transaction will resolve to TOKEN_HAS_NO_SUPPLY_KEY.
- The operation decreases the Total Supply of the Token.
- Total supply cannot go below zero.
- The amount provided must be in the lowest denomination possible.
- Example: Token A has 2 decimals. In order to burn 100 tokens, one must provide an amount of 10000. In order to burn 100.55 tokens, one must provide an amount of 10055.
Transaction Signing Requirements
- Supply key
- Transaction fee payer account key
Transaction Fees
Constructor | Description |
---|---|
new TokenBurnTransaction() | Initializes the TokenBurnTransaction object |
new TokenBurnTransaction()
V1
Method | Type | Description | Requirement |
---|---|---|---|
setTokenId(<tokenId>) | TokenId | The ID of the token to burn supply | Required |
setTokenAmount(<amount>) | long | The number of tokens to burn | Optional |
addSerial(<serial>) | long | Applicable to tokens of type NON_FUNGIBLE_UNIQUE . Serial ID to burn. | Optional |
setSerials(<serials>) | List<Long> | Applicable to tokens of type NON_FUNGIBLE_UNIQUE. A list of NFT serials to burn. | Optional |
Java
//Burn 1,000 tokens
TokenBurnTransaction transaction = new TokenBurnTransaction()
.setTokenId(newTokenId)
.setAmount(1000)
//Build the unsigned transaction, sign with the supply private key of the token, submit the transaction to a Hedera network
TransactionId transactionId = transaction.build(client).sign(supplyKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt getReceipt = transactionId.getReceipt(client);
//Obtain the transaction consensus status
Status transactionStatus = getReceipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);
//Version: 1.2.2
JavaScript
//Burn 1,000 tokens
const transaction = new TokenBurnTransaction()
.setTokenId(newTokenId)
.setAmount(1000)
//Build the unsigned transaction, sign with the supply private key of the token, submit the transaction to a Hedera network
const transactionId = await transaction.build(client).sign(supplyKey).execute(client);
//Request the receipt of the transaction
const getReceipt = await transactionId.getReceipt(client);
//Obtain the transaction consensus status
const transactionStatus = getReceipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//Version 1.4.2
Last modified 1yr ago