Delete an account
Methods
Method
Type
Description
Requirement
//Create the transaction to delete an account
AccountDeleteTransaction transaction = new AccountDeleteTransaction()
.setAccountId(accountId)
.setTransferAccountId(OPERATOR_ID);
//Freeze the transaction for signing, sign with the private key of the account that will be deleted, sign with the operator key and submit to a Hedera network
TransactionResponse txResponse = transaction.freezeWith(client).sign(newKey).execute(client);
//Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);
//Get the transaction consensus status
Status transactionStatus = receipt.status;
System.out.println("The transaction consensus status is " +transactionStatus);//Create the transaction to delete an account
const transaction = await new AccountDeleteTransaction()
.setAccountId(accountId)
.setTransferAccountId(OPERATOR_ID)
.freezeWith(client);
//Sign the transaction with the account key
const signTx = await transaction.sign(accountKey);
//Sign with the client operator private key and submit to a Hedera network
const txResponse = await signTx.execute(client);
//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);
//Get the transaction consensus status
const transactionStatus = receipt.status;
console.log("The transaction consensus status is " +transactionStatus);
//2.0.5Get transaction values
Method
Type
Description
Last updated