Burn a token
Constructor
Description
new TokenBurnTransaction()Methods
Method
Type
Description
Requirement
//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//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.2Last updated