A transaction that deletes a topic from the Hedera network. Once a topic is deleted, the topic cannot be recovered to receive messages and all submitMessage calls will fail. Older messages can still be accessed, even after the topic is deleted, via the mirror node.
Transaction Signing Requirements
If the adminKey was set upon the creation of the topic, the adminKey is required to sign to successfully delete the topic
If no adminKey was set upon the creating of the topic, you cannot delete the topic and will receive an UNAUTHORIZED error
Constructor | Description |
| Initializes a TopicDeleteTransaction object |
new TopicDeleteTransaction()
Method | Type | Description | Requirement |
| TopicId | The ID of the topic to delete | Required |
Java//Create the transactionTopicDeleteTransaction transaction = new TopicDeleteTransaction().setTopicId(newTopicId);//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction IDTransactionResponse txResponse = transaction.freezeWith(client).sign(adminKey).execute(client);​//Request the receipt of the transactionTransactionReceipt receipt = txResponse.getReceipt(client);​//Get the transaction consensus statusStatus transactionStatus = receipt.status;​System.out.println("The transaction consensus status is " +transactionStatus);​//V2.0.0
JavaScript//Create the transactionconst transaction = await new TopicDeleteTransaction().setTopicId(newTopicId).freezeWith(client);//Sign the transaction with the admin keyconst signTx = await transaction.sign(adminKey);//Sign with the client operator private key and submit to a Hedera networkconst 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 is " +transactionStatus);​//v2.0.5
Go//Create the transaction and freeze the transaction to prepare for signingtransaction := hedera.NewTopicDeleteTransaction().SetTopicID(topicID).FreezeWith(client)​//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction IDtxResponse, 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 statustransactionStatus := receipt.Status​fmt.Printf("The transaction consensus status is %v\n", transactionStatus)​//v2.0.0
​
Constructor | Description |
| Initializes a ConsensusTopicDeleteTransaction object |
new ConsensusTopicDeleteTransaction()
Method | Type | Description |
| TopicId | The ID of the topic to delete |
JavaConsensusTopicDeleteTransaction transaction = new ConsensusTopicDeleteTransaction().setTopicId(newTopicId);​//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction IDTransactionId txId = transaction.build(client).sign(adminKey).execute(client);​//Request the receipt of the transactionTransactionReceipt receipt = txId.getReceipt(client);​//Get the transaction consensus statusStatus transactionStatus = receipt.status;​System.out.println("The transaction consensus status is " +transactionStatus);​//v1.3.2
JavaScriptconst transaction = new ConsensusTopicDeleteTransaction().setTopicId(newTopicId);​//Sign the transaction with the admin key, sign with the client operator and submit the transaction to a Hedera network, get the transaction IDconst txId = await transaction.build(client).sign(adminKey).execute(client);​//Request the receipt of the transactionconst receipt = await txId.getReceipt(client);​//Get the transaction consensus statusconst transactionStatus = receipt.status;​console.log("The transaction consensus status is " +transactionStatus);​//v1.4.4
Method | Type | Description | Requirement |
| TopicId | The ID of the topic to delete | Required |
Java//Create the transactionTopicDeleteTransaction transaction = new TopicDeleteTransaction().setTopicId(newTopicId);​//Get topic IDTopicId getTopicId = transaction.getTopicId();​//v2.0.0
JavaScript//Create the transactionconst transaction = new TopicDeleteTransaction().setTopicId(newTopicId);​//Get topic IDconst getTopicId = transaction.getTopicId();​//v2.0.0
Go//Create the transactiontransaction := hedera.NewTopicDeleteTransaction().SetTopicID(topicID)​//Get topic IDgetTopicId := transaction.GetTopicID()​//v2.0.0