Skip to main content
A Hedera account is required to interact with any network service, since every transaction and query fee is paid from an account. You can create a previewnet or testnet account on the Hedera Developer Portal, or use a third-party wallet to generate a free mainnet account. This page covers programmatic account creation with AccountCreateTransaction(). The transaction must be signed and paid for by an existing account. To obtain the new account ID, request the receipt of the transaction. For a complete list of account properties, see the accounts overview.

Transaction fees and signing

  • The account paying for the transaction fee is required to sign the transaction.
  • The sender also pays the maxAutoAssociations fee and the rent for the first auto-renewal period.
  • See the transaction and query fees table for the base transaction fee.
  • Use the Hedera fee estimator to estimate cost.

Constructor

ConstructorDescription
new AccountCreateTransaction()Initializes the AccountCreateTransaction object

Methods

MethodTypeRequirement
setKey(<key>)KeyRequired
setKeyWithAlias(<key>)KeyOptional
setKeyWithoutAlias(<key>)KeyOptional
setAlias(<alias>)EvmAddressOptional
setInitialBalance(<initialBalance>)HbarOptional
setReceiverSignatureRequired(<booleanValue>)booleanOptional
setMaxAutomaticTokenAssociations(<amount>)intOptional
setStakedAccountId(<stakedAccountId>)AccountIdOptional
setStakedNodeId(<stakedNodeId>)longOptional
setDeclineStakingReward(<declineStakingReward>)booleanOptional
setAccountMemo(<memo>)StringOptional
setHighVolume(<highVolume>)booleanOptional
setAutoRenewPeriod(<autoRenewPeriod>)DurationDisabled

EVM address from public key

Setting an ECDSA-derived EVM address at creation makes the account natively addressable from EVM wallets, JSON-RPC, and Solidity (msg.sender). The address is the rightmost 20 bytes of the Keccak-256 hash of the ECDSA public key. Use setKeyWithAlias() to enable this behavior, as shown in the example below.Immutability: The EVM address is bound to the original ECDSA public key and does not change if you later rotate keys via CryptoUpdateTransaction. Integrations keyed to that EVM address (smart-contract permissions, address-based access lists) will continue to reference the original address.If key rotation is required: Use setKeyWithoutAlias() instead. The account will fall back to its EVM Address from Account ID (the long-zero form).Recovery model: If keys are compromised or must be replaced, create a new account with a new ECDSA key, then migrate assets and state. Do not rely on key rotation to preserve the same EVM identity.

High-volume entity creation

This transaction supports high-volume entity creation (HIP-1313). Setting setHighVolume(true) routes the transaction through dedicated high-volume throttle capacity with variable-rate pricing. Always pair this with setMaxTransactionFee() to cap your costs.

Maximum auto-associations

The maxAutoAssociations property determines how many automatic token associations an account allows.
ValueBehavior
0Automatic token associations and token airdrops are not allowed. Tokens must be manually associated. This also applies when the value is less than or equal to usedAutoAssociations.
-1Unlimited automatic token associations. This is the default for accounts created via auto account creation and for hollow accounts that have been completed. The sender still pays the association fee and initial rent for each new token.
> 0Automatic token associations are limited to the specified number.
Reference: HIP-904.

Example

// Create new ECDSA key
const ecdsaPublicKey = PrivateKey.generateECDSA().publicKey;

// Create the transaction
const transaction = new AccountCreateTransaction()
    // Sets the EVM Address from Public Key (recommended for EVM compatibility)
    .setKeyWithAlias(ecdsaPublicKey)
    // Use .setKeyWithoutAlias(ecdsaPublicKey) if you plan to rotate keys soon after creation
    .setInitialBalance(new Hbar(1));

// Sign the transaction with the client operator private key and submit to a Hedera network
const txResponse = await transaction.execute(client);

//Request the receipt of the transaction
const receipt = await txResponse.getReceipt(client);

//Get the account ID
const newAccountId = receipt.accountId;

console.log("The new account ID is " + newAccountId);

// v2.84.0

Get transaction values

MethodTypeDescription
getKey()KeyReturns the public key on the account
getInitialBalance()HbarReturns the initial balance of the account
getAutoRenewPeriod()DurationReturns the auto-renew period on the account
getDeclineStakingReward()booleanReturns whether the account declined staking rewards
getStakedNodeId()longReturns the staked node ID
getStakedAccountId()AccountIdReturns the staked account ID
getReceiverSignatureRequired()booleanReturns whether the receiver signature is required
getHighVolume()booleanReturns whether this transaction uses high-volume throttles