Skip to content

Latest commit

 

History

History
89 lines (66 loc) · 2 KB

AccountDeleteTransaction.md

File metadata and controls

89 lines (66 loc) · 2 KB

class AccountDeletedTransaction extends Transaction

Mark an account as deleted, moving all its current hbars to another account. It will remain in the ledger, marked as deleted, until it expires. Transfers into it a deleted account fail. But a deleted account can still have its expiration extended in the normal way.

Warning

When you delete an account, you need to sign it with the key set at account creation.

** Java **

new AccountDeleteTransaction()
    .setAccountId(accountId)
    .setNodeAccountIds(Collections.singletonList(response.nodeId))
    .setTransferAccountId(operatorId)
    .freezeWith(client)
    .sign(key)
    .execute(client)
    .getReceipt(client);

** JavaScript **

await (
    await (
        await new AccountDeleteTransaction()
            .setAccountId(account)
            .setNodeAccountIds([response.nodeId])
            .setTransferAccountId(operatorId)
            .setTransactionId(TransactionId.generate(account))
            .freezeWith(client)
            .sign(key)
    ).execute(client)
).getReceipt(client);
  • Duration is number and is the number of seconds

** Go **

newKey := hedera.GeneratePrivateKey()

transaction, err := hedera.NewAccountDeleteTransaction().
    SetNodeAccountIDs([]AccountID{resp.NodeID}).
    SetAccountID(accountID).
    SetTransferAccountID(client.GetOperatorAccountID()).
    SetTransactionID(TransactionIDGenerate(accountID)).
    FreezeWith(client)
if err != nil {
    println(err.Error())
}

resp, err = transaction.
    Sign(newKey).
    Execute(client)
if err != nil {
    println(err.Error())
}

_, err = resp.GetReceipt(client)
if err != nil {
    println(err.Error())
}

Constructor

constructor()

Properties

accountId: AccountId

The AccountId which should be deleted


transferAccountId: AccountId

The AccountId which will receive all remaining hbars