Skip to main content
Learn how to create a new Hedera account on testnet using the JavaScript, Java, Go, or Python SDK. A Hedera account is your identity on‑chain. It holds your HBAR (the network’s currency) and lets you sign transactions.

Get a testnet account from the portal

Before writing any code, get a funded testnet account and its keys from the developer portal. You can also submit your first transaction straight from the browser-based playground, with no setup.
1

Open the playground

OPEN PLAYGROUND

2

Submit a Transfer HBAR transaction

Under Account & HBAR, select Transfer HBAR from the left navigation.
  1. Replace receiverAccount with account ID 0.0.800.
  2. Then click Get Account Balance under Queries.
Click Execute to submit your first transaction.
3

Create your testnet account

When you click Execute, you are prompted to sign up for a developer portal account. Once logged in, click CREATE ACCOUNT to complete the testnet account creation flow. Your new account is automatically funded with 1000 HBAR.
4

Copy your account ID and key

View your account ID and ECDSA key pair from the portal dashboard. Use the account ID as your OPERATOR_ID and the DER Encoded Private Key (starts with 303...) as your OPERATOR_KEY in the steps below.

Prerequisites

  • A Hedera testnet operator account ID and ECDSA DER-encoded private key (from the portal above).
  • A small amount of testnet HBAR (ℏ) to pay the $0.05 account‑creation fee.
NoteYou can always check the ”Code Check” section at the bottom of each page to view the entire code if you run into issues. You can also post your issue to the respective SDK channel in our Discord community here.

Install the SDK

Open your terminal and create a directory hedera-examples directory. Then change into the newly created directory:
Initialize a node.js project in this new directory:
Ensure you have Node.js v18 or later installed on your machine. Then, install the JavaScript SDK.
Update your package.json file to enable ES6 modules and configure the project:
Create a createAccountDemo.js file and add the following imports:

Environment Variables

Set your testnet operator credentials as environment variables. Your OPERATOR_ID is your testnet account ID. Your OPERATOR_KEY is your testnet account’s corresponding ECDSA private key.

Step 1: Initialize Hedera Client

Load your operator credentials from environment variables and initialize your Hedera testnet client. This client will connect to the Hedera test network and use your operator account to sign transactions and pay transaction fees.

Step 2: Generate a New Key Pair

Generate a new ECDSA private/public key pair for the account you’ll create.

Why keys?

On the Hedera network, a private key allows you to sign transactions, ensuring only you control your assets, while a public key, shared on-chain, verifies your identity. This key pair is essential for account security.
‼️ Security reminder: Keep your private keys secure - anyone with access can control your account and funds.

Step 3: Create Your First Account on Hedera

Build an AccountCreateTransaction with the new public key and initial balance, then execute it. Specify the public key , an optional initial HBAR balance, and once you execute it, the network creates the account and returns the new AccountId in the receipt.

Step 4: Query the Account Balance Using Mirror Node API

Use the Mirror Node REST API to check your new account’s HBAR balance. Mirror nodes provide free access to network data without transaction fees. API endpoint:
Replace the placeholder:
  • {accountId} - Your new account ID from the creation transaction
Why this endpoint? This endpoint queries account balances directly by account ID. It returns detailed information including HBAR balance in tinybars, making it ideal for verifying the new account was funded with the expected initial balance.
Example URLs:
Complete Implementation:

✅ Code check

Before running your project, verify your code matches the complete example:

Run Your Project

Ensure your environment variables are set:

Expected sample output:

‼️ Troubleshooting


What just happened?

  1. The SDK built an AccountCreateTransaction and signed it with your operator key.
  2. A consensus node validated the signature and charged the account creation fee.
  3. After network consensus, a unique account ID and EVM address were assigned and returned in the receipt.
  4. The account was funded with 20 HBAR from your operator account.
  5. The Mirror Node API confirmed your new account exists with the expected balance.

Next steps


🎉 Great work! You now control a brand new Hedera account secured by your fresh key pair. Keep the private key safe and never commit it to source control.

Additional resources

Accounts | Hedera