Create an account
Create an account using the account create API
A transaction that creates a Hedera account. A Hedera account is required to interact with any of the Hedera network services as you need an account to pay for all associated transaction/query fees. You can visit the Hedera Developer Portal to create a previewnet or testnet account. You can also use third-party wallets to generate free mainnet accounts. To process an account create transaction, you will need an existing account to pay for the transaction fee. To obtain the new account ID, request the receipt of the transaction.
When creating a new account using theAccountCreateTransaction()
API you will need an existing account to pay for the associated transaction fee.
Account Properties
Account PropertiesTransaction Fees
The sender pays for the token association fee and the rent for the first auto-renewal period.
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.
Transaction Signing Requirements
The account paying for the transaction fee is required to sign the transaction.
Maximum Auto-Associations and Fees
Accounts have a property, maxAutoAssociations
, and the property's value determines the maximum number of automatic token associations allowed.
0
Automatic token associations or are not allowed, and the account must be manually associated with a token. This also applies if the value is less than or equal to usedAutoAssociations
.
-1
The number of automatic token associations an account can have is unlimited. -1
is the default value for new automatically-created accounts.
> 0
If the value is a positive number (number greater than 0), the number of automatic token associations an account can have is limited to that number.
The sender pays the maxAutoAssociations
fee and the rent for the first auto-renewal period for the association. This is in addition to the typical transfer fees. This ensures the receiver can receive tokens without association and makes it a smoother transfer process.
Reference: HIP-904
Methods
setKey(<key>)
Key
Required
setAlias(<alias>)
EvmAddress
Optional
setInitialBalance(<initialBalance>)
HBar
Optional
setReceiverSignatureRequired(<booleanValue>)
boolean
Optional
setMaxAutomaticTokenAssociations(<amount>)
int
Optional
setStakedAccountId(<stakedAccountId>)
AccountId
Optional
setStakedNodeId(<stakedNodeId>)
long
Optional
setDeclineStakingReward(<declineStakingReward>)
boolean
Optional
setAccountMemo(<memo>)
String
Optional
setAutoRenewPeriod(<autoRenewPeriod>)
Duration
Disabled
Account Alias
If an alias is set during account creation, it becomes immutable, meaning it cannot be changed. If you plan to update or rotate keys in the future, do not set the alias at the time of initial account creation. The alias can be set after finalizing all key updates.
Get transaction values
getKey()
Key
Returns the public key on the account
getInitialBalance()
Hbar
Returns the initial balance of the account
getAutoRenewPeriod()
Duration
Returns the auto renew period on the account
getDeclineStakingReward()
boolean
Returns whether or not the account declined rewards
getStakedNodeId()
long
Returns the node ID
getStakedAccountId()
AccountId
Returns the node account ID
getReceiverSignatureRequired()
boolean
Returns whether the receiver signature is required or not
Last updated