Deleting a token marks a token as deleted, though it will remain in the ledger. The operation must be signed by the specified Admin Key of the Token. If the Admin Key is not set, the Transaction will result in TOKEN_IS_IMMUTABlE. Once deleted update, mint, burn, wipe, freeze, unfreeze, grant KYC, revoke KYC and token transfer transactions will resolve to TOKEN_WAS_DELETED.
NFTs
You cannot delete a specific NFT. You can delete the class of the NFT specified by the token ID after you have burned all associated NFTs associated with the token class
Transaction Signing Requirements
Transaction fee payer account key
Transaction Fees
Please see the transaction and query fees table for the base transaction fee
Please use the Hedera fee estimator to estimate your transaction fee cost
Methods
Method | Type | Description | Requirement |
---|---|---|---|
| The ID of the token to delete | Required |
//Create the transactionTokenDeleteTransaction transaction = new TokenDeleteTransaction() .setTokenId(tokenId);//Freeze the unsigned transaction, sign with the admin private key of the account, submit the transaction to a Hedera networkTransactionResponse txResponse = transaction.freezeWith(client).sign(adminKey).execute(client);//Request the receipt of the transactionTransactionReceipt receipt = txResponse.getReceipt(client);//Obtain the transaction consensus statusStatus transactionStatus = receipt.status;System.out.println("The transaction consensus status is " +transactionStatus);//v2.0.1
//Create the transaction and freeze the unsigned transaction for manual signingconst transaction = await new TokenDeleteTransaction() .setTokenId(tokenId) .freezeWith(client);//Sign with the admin private key of the token const signTx = await transaction.sign(adminKey);//Submit the transaction to a Hedera network const txResponse = await signTx.execute(client);//Request the receipt of the transactionconst receipt = await txResponse.getReceipt(client); //Get the transaction consensus statusconst transactionStatus = receipt.status;console.log("The transaction consensus status " +transactionStatus.toString());//v2.0.5
//Create the transaction and freeze the unsigned transaction for manual signingtransaction, err = hedera.NewTokenDeleteTransaction().SetTokenID(tokenId).FreezeWith(client)if err != nil {panic(err)}//Sign with the admin private key of the account, submit the transaction to a Hedera networktxResponse, err := transaction.Sign(adminKey).Execute(client)if err != nil {panic(err)}//Request the receipt of the transactionreceipt, err = txResponse.GetReceipt(client)if err != nil {panic(err)}//Get the transaction consensus statusstatus := receipt.Statusfmt.Printf("The transaction consensus status is %v\n", status)//v2.1.0
Last updated