Hedera
Search…
Update an Account
A transaction that updates the properties of an existing account. The network will store the latest updates on the account. If you would like to retrieve the state of an account in the past, you can query a mirror node.
Transaction Fees
  • Please see the transaction and query fees table for base transaction fee
  • Please use the Hedera fee estimator to estimate your transaction fee cost
Transaction Signing Requirements
  • The account key(s) are required to sign the transaction
  • If you are updating the keys on the account the OLD KEY and NEW KEY must sign
    • If either is a key list then the key list keys are all required to sign
    • If either is a threshold key, the threshold value is required to sign
  • If you do not have the required signatures, the network will throw an INVALID_SIGNATURE error
Account Properties
Field
Description
Key
The new key for the account. The old key and new key must sign the transaction. If the old key or new key is a threshold key then only the threshold of the old key and new key are required to sign the transaction.
Expiration
The new expiration for the account
Receiver Signature Required
If true, all the account keys must sign any transaction depositing into this account (in addition to all withdrawals).
default: false
Max Automatic Token Associations
Setting this account property will modify the existing automatic token association value. If you are trying to reduce the number of auto token association slots, please make sure those slots are empty. If those slots are not empty, please dissociate tokens that were auto associated. The max automatic token association is 1,000 token IDs.
​
Update: There is no limit on how many tokens you can associate in the 0.25 mainnet release. Currently, live on previewnet and testnet. Reference HIP-23 and HIP-367.
Memo
Add or update a short description that should be recorded with the state of the account entity (maximum length of 100 characters). Anyone can view this memo on the network.
Auto Renew Period
The new period of time in which the account will auto-renew in seconds. The account is charged tinybars for every auto-renew period. Duration type is in seconds. For example, one hour would result in an input value of 3,600 seconds. NOTE: This is fixed to approximately 3 months (7890000 seconds). Any other value will return the following error: AUTORENEW_DURATION_NOT_IN_RANGE.
default: 2,592,000 seconds
Proxy Account
The new account ID to which this account is proxy staked.
Constructor
Description
new AccountUpdateTransaction()
Initializes the AccountUpdateTransaction object
1
new AccountUpdateTransaction()
Copied!

Methods

V2
V1
Method
Type
Requirement
setAccountId(<accountId>)
AccountId
Required
setKey(<key>)
Key
Optional
setReceiverSignatureRequired(<boolean>)
Boolean
Optional
setMaxAutomaticTokenAssociations(<amount>)
int
Optional
setAccountMemo(<memo>)
String
Optional
setAutoRenewPeriod(<duration>)
Duration
Disabled
setExpirationTime(<expirationTime>)
Instant
Disabled
setProxyAccountId(<accountId>)
AccountId
Disabled
Java
1
//Create the transaction to update the key on the account
2
AccountUpdateTransaction transaction = new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(updateKey);
5
​
6
//Sign the transaction with the old key and new key, submit to a Hedera network
7
TransactionResponse txResponse = transaction.freezeWith(client).sign(oldKey).sign(newKey).execute(client);
8
​
9
//Request the receipt of the transaction
10
TransactionReceipt receipt = txResponse.getReceipt(client);
11
​
12
//Get the transaction consensus status
13
Status transactionStatus = receipt.status;
14
​
15
System.out.println("The transaction consensus status is " +transactionStatus);
16
​
17
//Version 2.0.0
Copied!
JavaScript
1
//Create the transaction to update the key on the account
2
const transaction = await new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(updateKey)
5
.freezeWith(client);
6
​
7
//Sign the transaction with the old key and new key
8
const signTx = await (await transaction.sign(oldKey)).sign(newKey);
9
​
10
//SIgn the transaction with the client operator private key and submit to a Hedera network
11
const txResponse = await signTx.execute(client);
12
​
13
//Request the receipt of the transaction
14
const receipt = await txResponse.getReceipt(client);
15
​
16
//Get the transaction consensus status
17
const transactionStatus = receipt.status;
18
​
19
console.log("The transaction consensus status is " +transactionStatus.toString());
20
​
21
//v2.0.5
Copied!
Go
1
//Create the transaction to update the key on the account
2
transaction, err := hedera.NewAccountUpdateTransaction().
3
SetAccountID(newAccountId).
4
SetKey(updateKey.PublicKey()).
5
FreezeWith(client)
6
​
7
if err != nil {
8
panic(err)
9
}
10
​
11
//Sign the transaction with the old key and new key, submit to a Hedera network
12
txResponse, err := transaction.Sign(newKey).Sign(updateKey).Execute(client)
13
​
14
//Request the receipt of the transaction
15
receipt, err := txResponse.GetReceipt(client)
16
if err != nil {
17
panic(err)
18
}
19
​
20
//Get the transaction consensus status
21
transactionStatus := receipt.Status
22
​
23
println("The transaction consensus status is ", transactionStatus)
24
​
25
//Version 2.0.0
Copied!
Method
Type
Requirement
setAccountId(<accountId>)
AccountId
Required
setKey(<key>)
PublicKey
Optional
setAutoRenewPeriod(<duration>)
Duration
Optional
setExpirationTime(<expirationTime>)
Instant
Optional
setReceiverSignatureRequired(<boolean>)
Boolean
Optional
setProxyAccountId(<accountId>)
AccountId
Optional
Java
1
//Create the transaction to update the key on the account
2
AccountUpdateTransaction transaction = new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(updateKey);
5
​
6
//Sign the transaction with the old key and new key, submit to a Hedera network
7
TransactionId txId = transaction.build(client).sign(oldKey).sign(newKey).execute(client);
8
​
9
//Request the receipt of the transaction
10
TransactionReceipt receipt = txId.getReceipt(client);
11
​
12
//Get the transaction consensus status
13
Status transactionStatus = receipt.status;
14
​
15
System.out.println("The transaction consensus status is " +transactionStatus);
16
​
17
//Version 1.3.2
Copied!
JavaScript
1
//Create the transaction to update the key on the account
2
const transaction = new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(newKey);
5
​
6
//Sign the transaction with the old key and new key, submit to a Hedera network
7
const txId = await transaction.build(client).sign(oldKey).sign(newKey).execute(client);
8
​
9
//Request the receipt of the transaction
10
const receipt = await txId.getReceipt(client);
11
​
12
//Get the transaction consensus status
13
const transactionStatus = receipt.status;
14
​
15
console.log("The transaction consensus status is " +transactionStatus);
16
​
17
//v1.4.4
Copied!

Get transaction values

Return the properties of an account create transaction.
V2
Method
Type
Description
getKey()
Key
Returns the public key on the account
getInitialBalance()
Hbar
Returns the initial balance of the account
getReceiverSignatureRequired()
boolean
Returns whether the receiver signature is required or not
getExpirationTime()
Instant
Returns the expiration time
getAutoRenewPeriod()
Duration
Returns the auto renew period on the account
Java
1
//Create a transaction
2
AccountUpdateTransaction transaction = new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(newKeyUpdate);
5
​
6
//Get the key on the account
7
Key accountKey = transaction.getKey();
8
​
9
//v2.0.0
Copied!
JavaScript
1
//Create a transaction
2
const transaction = new AccountUpdateTransaction()
3
.setAccountId(accountId)
4
.setKey(newKeyUpdate);
5
​
6
//Get the key of an account
7
const accountKey = transaction.getKey();
8
​
9
//v2.0.0
Copied!
Go
1
//Create the transaction
2
transaction, err := hedera.NewAccountUpdateTransaction().
3
SetAccountID(newAccountId).
4
SetKey(updateKey.PublicKey())
5
​
6
//Get the key of an account
7
accountKey := transaction.GetKey()
8
​
9
//v2.0.0
Copied!