> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hedera.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an Account

Learn how to create a new Hedera **account** on *testnet* using the JavaScript, Java, Go, SDK, or Python. A [`Hedera account`](/learn/core-concepts/accounts) is your identity on‑chain. It holds your HBAR (the network’s currency) and lets you sign transactions.

***

## Prerequisites

* A Hedera testnet **operator account ID** and **ECDSA** **DER-encoded private key** (from the [Quickstart](/native/quickstart/javascript)).
* A small amount of testnet **HBAR (ℏ)** to pay the `$0.05` account‑creation fee.

<Note>
  ***Note***

  *You can always check the "*✅ [*Code Check*](#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*](http://hedera.com/discord)*.*
</Note>

***

## Install the SDK

<Tabs>
  <Tab title="JavaScript">
    Open your terminal and create a directory `hedera-examples` directory. Then change into the newly created directory:

    ```bash theme={null}
    mkdir hedera-examples && cd hedera-examples
    ```

    Initialize a `node.js` project in this new directory:

    ```bash theme={null}
    npm init -y
    ```

    Ensure you have [**Node.js**](https://nodejs.org/en/download) `v18` or later installed on your machine. Then, install the[ JavaScript SDK](https://github.com/hiero-ledger/hiero-sdk-js).

    ```bash theme={null}
    npm install --save @hashgraph/sdk
    ```

    Update your `package.json` file to enable ES6 modules and configure the project:

    ```json highlight={4} theme={null}
    {
      "name": "hedera-examples",
      "version": "1.0.0",
      "type": "module",
      "main": "createAccountDemo.js",
      "scripts": {
        "start": "node createAccountDemo.js"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "dependencies": {
        "@hashgraph/sdk": "^2.69.0"
      }
    }
    ```

    Create a `createAccountDemo.js` file and add the following imports:

    ```javascript theme={null}
    import {
      Client,
      PrivateKey,
      AccountCreateTransaction,
      Hbar,
    } from "@hashgraph/sdk";
    ```
  </Tab>

  <Tab title="Java">
    Add the[ Java SDK](https://github.com/hiero-ledger/hiero-sdk-java) dependency to your Maven project's `pom.xml` and create your source file:

    Create a new **Maven** project and name it `HederaExamples`. Add the following dependencies to your `pom.xml` file:

    ```xml theme={null}
    <dependencies>
        <dependency>
            <groupId>com.hedera.hashgraph</groupId>
            <artifactId>sdk</artifactId>
            <version>2.61.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty-shaded</artifactId>
            <version>1.73.0</version>
        </dependency>
    </dependencies>
    ```

    Or for **Gradle** projects using the Groovy DSL, add these dependencies to your `build.gradle` file and install the dependencies using `./gradlew build`

    ```gradle theme={null}
    plugins {
        id 'java'
        id 'application'
    }

    repositories {
        mavenCentral()
    }

    dependencies {
        implementation 'com.hedera.hashgraph:sdk:2.60.0'
        implementation 'com.google.code.gson:gson:2.10.1'
        implementation 'io.grpc:grpc-netty-shaded:1.61.0'
    }

    application {
        mainClass = 'CreateAccountDemo'
        // or 'com.example.CreateAccountDemo' if it's in a package
    }
    ```

    Create a `CreateAccountDemo.java` class in `src/main/java/` with the following imports:

    ```java theme={null}
    import com.hedera.hashgraph.sdk.*;
    import java.net.http.HttpClient;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;
    import java.net.URI;
    import com.google.gson.Gson;
    import com.google.gson.JsonObject;
    import com.google.gson.JsonArray;

    public class CreateAccountDemo {
        public static void main(String[] args) throws Exception {
            // Your account creation code will go here
        }
    }
    ```
  </Tab>

  <Tab title="Go">
    Create a new file `create_account_demo.go` and import the following packages to your file:

    ```go theme={null}
    import (
        "encoding/json"
        "fmt"
        "io"
        "net/http"
        "os"
        "time"

        hedera "github.com/hiero-ledger/hiero-sdk-go/v2/sdk"
    )
    ```

    In your project's root directory, initialize modules and pull in the [Go SDK](https://github.com/hiero-ledger/hiero-sdk-go):

    ```wrap theme={null}
    ```

    ```go-module theme={null}
    go mod init create_account_demo
    go get github.com/hiero-ledger/hiero-sdk-go/v2@latest
    go mod tidy
    ```
  </Tab>

  <Tab title="Python">
    **Before you start:** Ensure you have Python 3.10+ installed on your machine. Run this command to verify.

    ```bash theme={null}
    python --version
    ```

    If the `python --version` command is not found or shows a version lower than 3.10, install or upgrade Python from [Python Install](https://www.python.org/downloads/).

    **Note:** On some systems, you may need to use `python3` instead of `python` for initial setup commands. If `python --version` doesn't work, try `python3 --version` and use `python3` for the virtual environment creation. After activating the virtual environment, always use `python` for all commands.

    Open your terminal and create a working directory for your Hedera project. Then navigate into the new directory:

    ```bash theme={null}
    mkdir hedera-examples && cd hedera-examples
    ```

    **Verify Python and pip:** Ensure you have Python 3.10+ and pip installed on your machine. Run these commands to check:

    ```bash theme={null}
    python --version
    ```

    ```bash theme={null}
    python -m pip --version
    ```

    Create a virtual environment to isolate your project dependencies (Python best practice):

    ```bash theme={null}
    python -m venv .venv
    ```

    Activate the virtual environment to use the isolated Python installation:

    <Tabs>
      <Tab title="Mac/Linux">
        ```bash theme={null}
        source .venv/bin/activate
        ```
      </Tab>

      <Tab title="Windows">
        ```bash theme={null}
        .venv\Scripts\activate
        ```
      </Tab>
    </Tabs>

    Upgrade pip to ensure you have the latest package installer (recommended):

    ```bash theme={null}
    python -m pip install --upgrade pip
    ```

    Install the [Python SDK](https://github.com/hiero-ledger/hiero-sdk-python):

    ```bash theme={null}
    python -m pip install hiero_sdk_python
    ```

    Create a file named `CreateAccountDemo.py` and add the following imports:

    ```python theme={null}
    import os
    import time
    import requests

    from hiero_sdk_python import (
        Client,
        AccountId,
        PrivateKey,
        AccountCreateTransaction,
        Hbar,
    )

    # Used to print the EVM address for the new ECDSA public key
    from hiero_sdk_python.utils.crypto_utils import keccak256
    ```
  </Tab>
</Tabs>

***

## 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.

```bash theme={null}
export OPERATOR_ID="0.0.1234"
export OPERATOR_KEY="3030020100300506032b657004220420..."
```

***

## 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.

<CodeGroup>
  ```js JavaScript theme={null}
  // Load your operator credentials
  const operatorId  = process.env.OPERATOR_ID;
  const operatorKey = process.env.OPERATOR_KEY;

  // Initialize your testnet client and set operator
  const client = Client.forTestnet()
  .setOperator(operatorId, operatorKey);

  ```

  ```java Java theme={null}
  // Load your operator credentials
  AccountId operatorId = AccountId.fromString(System.getenv("OPERATOR_ID"));
  PrivateKey operatorKey = PrivateKey.fromString(System.getenv("OPERATOR_KEY"));

  // Initialize your testnet client and set operator
  Client client = Client.forTestnet().setOperator(operatorId, operatorKey);
  ```

  ```go Go highlight={1} theme={null}
  // load your operator credentials
  operatorId, _ := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
  operatorKey, _ := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))

  // initialize the client for testnet
  client := hedera.ClientForTestnet()
  client.SetOperator(operatorId, operatorKey)

  ```

  ```python Python theme={null}
  # Load your operator credentials
  operatorId = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
  operatorKey = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))

  # Initialize your testnet client and set operator
  client = Client()
  client.set_operator(operatorId, operatorKey)
  ```
</CodeGroup>

***

## 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.

<CodeGroup>
  ```js JavaScript theme={null}
  // generates a new ECDSA key pair in memory
  const newPrivateKey = PrivateKey.generateECDSA();
  const newPublicKey = newPrivateKey.publicKey;
  ```

  ```java Java theme={null}
  // generate an ECDSA key pair in memory
  PrivateKey newPrivateKey = PrivateKey.generateECDSA();
  PublicKey newPublicKey   = newPrivateKey.getPublicKey();
  ```

  ```go Go theme={null}
  // generate a new key pair
  newPrivateKey, _ := hedera.PrivateKeyGenerateEcdsa()
  newPublicKey := newPrivateKey.PublicKey()
  ```

  ```python Python theme={null}
  # generate a new ECDSA key pair in memory
  newPrivateKey = PrivateKey.generate_ecdsa()
  newPublicKey = newPrivateKey.public_key()
  ```
</CodeGroup>

<Warning>
  **‼️ Security reminder**: Keep your private keys secure - anyone with access
  can control your account and funds.
</Warning>

***

## 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.

<CodeGroup>
  ```js JavaScript theme={null}
  // Build & execute the account creation transaction
  const transaction = new AccountCreateTransaction()
    .setECDSAKeyWithAlias(newPublicKey)  // set the account key
    .setInitialBalance(new Hbar(20));    // fund with 20 HBAR

  const txResponse = await transaction.execute(client);
  const receipt = await txResponse.getReceipt(client);
  const newAccountId = receipt.accountId;

  console.log(`\nHedera Account created: ${newAccountId}`);
  console.log(`EVM Address: 0x${newPublicKey.toEvmAddress()}`);

  ```

  ```java Java theme={null}
  // Build & execute the account creation transaction
  AccountCreateTransaction transaction = new AccountCreateTransaction()
      .setKeyWithAlias(newPublicKey) // set the account key
      .setInitialBalance(new Hbar(20)); // fund with 20 HBAR

  TransactionResponse txResponse = transaction.execute(client);
  TransactionReceipt receipt = txResponse.getReceipt(client);
  AccountId newAccountId = receipt.accountId;

  System.out.println("\nHedera Account created: " + newAccountId);
  System.out.println("EVM Address: 0x" + newPublicKey.toEvmAddress());
  ```

  ```go Go theme={null}
  // build & execute the account creation transaction
  transaction := hedera.NewAccountCreateTransaction().
      SetECDSAKeyWithAlias(newPublicKey).     // set the account key
      SetInitialBalance(hedera.NewHbar(20))   // fund with 20 HBAR

  // execute the transaction and get response
  txResponse, err := transaction.Execute(client)
  if err != nil {
      panic(err)
  }

  // get the receipt to extract the new account ID
  receipt, err := txResponse.GetReceipt(client)
  if err != nil {
      panic(err)
  }

  newAccountId := *receipt.AccountID

  fmt.Printf("Hedera Account created: %s\n", newAccountId.String())
  fmt.Printf("EVM Address: 0x%s\n", newPublicKey.ToEvmAddress())
  ```

  ```python Python theme={null}
  # Build & execute the account creation transaction
  transaction = (
      AccountCreateTransaction()
        .set_key(newPublicKey)            # set the account key
        .set_initial_balance(Hbar(20))    # fund with 20 HBAR
  )

  # Get the receipt to extract the new account ID
  receipt = transaction.execute(client)
  newAccountId = receipt.account_id

  evm_address = keccak256(newPublicKey.to_bytes_ecdsa(compressed=False)[1:])[-20:].hex()

  print(f"\nHedera account created: {newAccountId}")
  print(f"EVM Address: 0x{evm_address}")
  ```
</CodeGroup>

***

## 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:**

```
/api/v1/balances?account.id={accountId}
```

**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:**

<CodeGroup>
  ```javascript JavaScript theme={null}
  const mirrorNodeUrl = `https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=${newAccountId}`;
  ```

  ```java Java theme={null}
  String mirrorNodeUrl = "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId;
  ```

  ```go Go theme={null}
  mirrorNodeUrl := "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId.String( )
  ```

  ```python Python theme={null}
  mirror_node_url = f"https://testnet.mirrornode.hedera.com/api/v1/balances?account.id={newAccountId}"
  ```
</CodeGroup>

**Complete Implementation:**

<CodeGroup>
  ```js JavaScript theme={null}
  // Wait for Mirror Node to populate data
  console.log("\nWaiting for Mirror Node to update...");
  await new Promise((resolve) => setTimeout(resolve, 6000));

  // Query balance using Mirror Node
  const mirrorNodeUrl = `https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=${newAccountId}`;

  const response = await fetch(mirrorNodeUrl);
  const data = await response.json();

  if (data.balances && data.balances.length > 0) {
    const balanceInTinybars = data.balances[0].balance;
    const balanceInHbar = balanceInTinybars / 100000000;
    console.log(`\nAccount balance: ${balanceInHbar} ℏ\n`);
  } else {
    console.log("Account balance not yet available in Mirror Node");
  }

  client.close();
  ```

  ```java Java theme={null}
  // Wait for Mirror Node to populate data
  System.out.println("\nWaiting for Mirror Node to update...");
  Thread.sleep(6000);

  // Query balance using Mirror Node
  String mirrorNodeUrl = "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId;

  HttpClient httpClient = HttpClient.newHttpClient( );
  HttpRequest request = HttpRequest.newBuilder().uri(URI.create(mirrorNodeUrl)).build();
  HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString( ));

  JsonObject data = new Gson().fromJson(response.body(), JsonObject.class);
  JsonArray balances = data.getAsJsonArray("balances");

  if (balances.size() > 0) {
      long balanceInTinybars = balances.get(0).getAsJsonObject().get("balance").getAsLong();
      double balanceInHbar = balanceInTinybars / 100000000.0;
      System.out.println("\nAccount balance: " + balanceInHbar + " ℏ\n");
  } else {
      System.out.println("Account balance not yet available in Mirror Node");
  }

  client.close();
  ```

  ```go Go theme={null}
  // wait for Mirror Node to populate data
  fmt.Println("\nWaiting for Mirror Node to update...")
  time.Sleep(6 * time.Second)

  // query balance using Mirror Node
  mirrorNodeUrl := "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId.String()
  resp, _ := http.Get(mirrorNodeUrl)
  defer resp.Body.Close()

  body, _ := io.ReadAll(resp.Body)

  var data struct {
  	Balances []struct {
  		Balance int64 `json:"balance"`
  	} `json:"balances"`
  }

  json.Unmarshal(body, &data)

  if len(data.Balances) > 0 {
  	balanceInTinybars := data.Balances[0].Balance
  	balanceInHbar := float64(balanceInTinybars) / 100000000.0
  	fmt.Printf("\nAccount balance: %g ℏ\n\n", balanceInHbar)
  } else {
  	fmt.Println("\nAccount balance not yet available in Mirror Node")
  }

  client.Close()
  ```

  ```python Python theme={null}
  # Wait for Mirror Node to populate data
  print("\nWaiting for Mirror Node to update...\n")
  time.sleep(6)

  # Query balance using Mirror Node
  mirrorNodeUrl = f"https://testnet.mirrornode.hedera.com/api/v1/balances?account.id={newAccountId}"

  response = requests.get(mirrorNodeUrl, timeout=10)
  response.raise_for_status()
  data = response.json()
  balances = data.get("balances", [])

  if balances:
      balanceInTinybars = balances[0].get("balance", 0)
      balanceInHbar = balanceInTinybars / 100_000_000
      print(f"Account balance: {balanceInHbar:g} ℏ\n")
  else:
      print("Account balance not yet available in Mirror Node")
  ```
</CodeGroup>

***

## ✅ Code check

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

<AccordionGroup>
  <Accordion title="JavaScript">
    ```javascript wrap theme={null}
    import {
      Client,
      PrivateKey,
      AccountCreateTransaction,
      Hbar
    } from "@hashgraph/sdk";

    async function createAccountDemo() {
    // load your operator credentials
    const operatorId = process.env.OPERATOR_ID;
    const operatorKey = process.env.OPERATOR_KEY;

    // initialize the client for testnet
    const client = Client.forTestnet()
    .setOperator(operatorId, operatorKey);

    // generate a new key pair
    const newPrivateKey = PrivateKey.generateECDSA();
    const newPublicKey = newPrivateKey.publicKey;

    // build & execute the account creation transaction
    const transaction = new AccountCreateTransaction()
    .setECDSAKeyWithAlias(newPublicKey) // set the account key with alias
    .setInitialBalance(new Hbar(20)); // fund with 20 HBAR

    const txResponse = await transaction.execute(client);
    const receipt = await txResponse.getReceipt(client);
    const newAccountId = receipt.accountId;

    console.log(`\nHedera account created: ${newAccountId}`);
    console.log(`EVM Address: 0x${newPublicKey.toEvmAddress()}`);

    // Wait for Mirror Node to populate data
    console.log("\nWaiting for Mirror Node to update...");
    await new Promise(resolve => setTimeout(resolve, 6000));

    // query balance using Mirror Node
    const mirrorNodeUrl = `https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=${newAccountId}`;

    const response = await fetch(mirrorNodeUrl);
    const data = await response.json();

    if (data.balances && data.balances.length > 0) {
    const balanceInTinybars = data.balances[0].balance;
    const balanceInHbar = balanceInTinybars / 100000000;

        console.log(`\nAccount balance: ${balanceInHbar} ℏ\n`);

    } else {
    console.log("Account balance not yet available in Mirror Node");
    }

    client.close();
    }

    createAccountDemo().catch(console.error);

    ```
  </Accordion>

  <Accordion title="Java">
    ```java wrap theme={null}
    import com.hedera.hashgraph.sdk.*;
    import java.net.http.HttpClient;
    import java.net.http.HttpRequest;
    import java.net.http.HttpResponse;
    import java.net.URI;
    import com.google.gson.Gson;
    import com.google.gson.JsonObject;
    import com.google.gson.JsonArray;

    public class CreateAccountDemo {
        public static void main(String[] args) throws Exception {
            // load your operator credentials
            String operatorId = System.getenv("OPERATOR_ID");
            String operatorKey = System.getenv("OPERATOR_KEY");

            // initialize the client for testnet
            Client client = Client.forTestnet()
                .setOperator(AccountId.fromString(operatorId),         PrivateKey.fromString(operatorKey));

            // generate a new key pair
            PrivateKey newPrivateKey = PrivateKey.generateECDSA();
            PublicKey newPublicKey = newPrivateKey.getPublicKey();

            // build & execute the account creation transaction
            AccountCreateTransaction transaction = new AccountCreateTransaction()
                // set the account key with alias
                .setKeyWithAlias(newPublicKey)
                .setInitialBalance(new Hbar(20)); // fund with 20 HBAR

            TransactionResponse txResponse = transaction.execute(client);
            TransactionReceipt receipt = txResponse.getReceipt(client);
            AccountId newAccountId = receipt.accountId;

            System.out.println("\nHedera account created: " + newAccountId);
            System.out.println("EVM Address: 0x" + newPublicKey.toEvmAddress() + "\n");

            // Wait for Mirror Node to populate data
            System.out.println("\nWaiting for Mirror Node to update...\n");
            Thread.sleep(6000);

            // query balance using Mirror Node
            String mirrorNodeUrl = "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId;

            HttpClient httpClient = HttpClient.newHttpClient();
            HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(mirrorNodeUrl))
                .build();

            HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
            Gson gson = new Gson();
            JsonObject data = gson.fromJson(response.body(), JsonObject.class);

            if (data.has("balances") && data.getAsJsonArray("balances").size() > 0) {
                JsonArray balances = data.getAsJsonArray("balances");
                JsonObject accountBalance = balances.get(0).getAsJsonObject();
                long balanceInTinybars = accountBalance.get("balance").getAsLong();
                double balanceInHbar = balanceInTinybars / 100000000.0;

                System.out.println("Account balance: " + balanceInHbar + " ℏ\n");
            } else {
                System.out.println("Account balance not yet available in Mirror Node");
            }

            client.close();
        }
    }
    ```
  </Accordion>

  <Accordion title="Go">
    ```go wrap theme={null}
    package main

    import (
    	"encoding/json"
    	"fmt"
    	"io"
    	"net/http"
    	"os"
    	"time"

        hedera "github.com/hiero-ledger/hiero-sdk-go/v2/sdk"

    )

    func main() {
    // load your operator credentials
    operatorId, _ := hedera.AccountIDFromString(os.Getenv("OPERATOR_ID"))
    operatorKey, _ := hedera.PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))

        // initialize the client for testnet
        client := hedera.ClientForTestnet()
        client.SetOperator(operatorId, operatorKey)

        // generate a new key pair
        newPrivateKey, _ := hedera.PrivateKeyGenerateEcdsa()
        newPublicKey := newPrivateKey.PublicKey()

        // build & execute the account creation transaction
        transaction := hedera.NewAccountCreateTransaction().
        	SetECDSAKeyWithAlias(newPublicKey).   // set the account key with alias
        	SetInitialBalance(hedera.NewHbar(20)) // fund with 20 HBAR

        txResponse, _ := transaction.Execute(client)
        receipt, _ := txResponse.GetReceipt(client)
        newAccountId := *receipt.AccountID

        fmt.Printf("\nHedera account created: %s\n", newAccountId.String())
        fmt.Printf("EVM Address: 0x%s\n", newPublicKey.ToEvmAddress())

        // wait for Mirror Node to populate data
        fmt.Println("\nWaiting for Mirror Node to update...")
        time.Sleep(6 * time.Second)

        // query balance using Mirror Node
        mirrorNodeUrl := "https://testnet.mirrornode.hedera.com/api/v1/balances?account.id=" + newAccountId.String()
        resp, _ := http.Get(mirrorNodeUrl)
        defer resp.Body.Close()

        body, _ := io.ReadAll(resp.Body)

        var data struct {
        	Balances []struct {
        		Balance int64 `json:"balance"`
        	} `json:"balances"`
        }

        json.Unmarshal(body, &data)

        if len(data.Balances) > 0 {
        	balanceInTinybars := data.Balances[0].Balance
        	balanceInHbar := float64(balanceInTinybars) / 100000000.0
        	fmt.Printf("\nAccount balance: %g ℏ\n\n", balanceInHbar)
        } else {
        	fmt.Println("\nAccount balance not yet available in Mirror Node")
        }

        client.Close()

    }

    ```
  </Accordion>

  <Accordion title="Python">
    ```python wrap theme={null}
    import os
    import time
    import requests
    from hiero_sdk_python import (
        Client, AccountId, PrivateKey, AccountCreateTransaction, Hbar
    )
    from hiero_sdk_python.utils.crypto_utils import keccak256

    # load your operator credentials
    operatorId = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
    operatorKey = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))

    # initialize the client for testnet
    client = Client()
    client.set_operator(operatorId, operatorKey)

    # generate a new key pair
    newPrivateKey = PrivateKey.generate_ecdsa()
    newPublicKey = newPrivateKey.public_key()

    # build & execute the account creation transaction
    transaction = (
        AccountCreateTransaction()
          .set_key(newPublicKey)            # set the account key
          .set_initial_balance(Hbar(20))    # fund with 20 HBAR
    )
    receipt = transaction.execute(client)
    newAccountId = receipt.account_id
    evm_address = keccak256(newPublicKey.to_bytes_ecdsa(compressed=False)[1:])[-20:].hex()

    print(f"\nHedera account created: {newAccountId}")
    print(f"EVM Address: 0x{evm_address}")

    # wait for Mirror Node to populate data
    print("\nWaiting for Mirror Node to update...\n")
    time.sleep(6)

    # query balance using Mirror Node
    mirrorNodeUrl = f"https://testnet.mirrornode.hedera.com/api/v1/balances?account.id={newAccountId}"
    response = requests.get(mirrorNodeUrl, timeout=10)
    response.raise_for_status()
    data = response.json()
    balances = data.get("balances", [])

    if balances:
        balanceInTinybars = balances[0].get("balance", 0)
        balanceInHbar = balanceInTinybars / 100_000_000
        print(f"Account balance: {balanceInHbar:g} ℏ\n")
    else:
        print("Account balance not yet available in Mirror Node")

    client.close()
    ```
  </Accordion>
</AccordionGroup>

***

## Run Your Project

Ensure your environment variables are set:

```bash theme={null}
export OPERATOR_ID="0.0.1234"
export OPERATOR_KEY="3030020100300506032b657004220420..."
```

<Tabs>
  <Tab title="JavaScript">
    ```bash theme={null}
    node createAccountDemo.js
    ```
  </Tab>

  <Tab title="Java Maven">
    ```bash theme={null}
    mvn compile exec:java -Dexec.mainClass="com.example.CreateAccountDemo"
    ```
  </Tab>

  <Tab title="Java Gradle">
    ```gradle theme={null}
    ./gradlew run
    ```
  </Tab>

  <Tab title="Go">
    ```bash theme={null}
    go run create_account_demo.go
    ```
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    python CreateAccountDemo.py
    ```

    **When finished, deactivate the virtual environment:**

    ```bash theme={null}
    deactivate
    ```
  </Tab>
</Tabs>

#### **Expected sample output:**

```
Hedera account created: 0.0.12345
EVM Address: 0xabcdef0123456789abcdef0123456789abcdef01

Waiting for Mirror Node to update...

Account balance: 20 ℏ
```

### ‼️ Troubleshooting

<Accordion title="Common ERROR messages and solutions ⬇️">
  <table>
    <thead>
      <tr>
        <th>Error message</th>
        <th>Likely cause</th>
        <th>Fix</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>
          <code>INSUFFICIENT\_PAYER\_BALANCE</code>
        </td>

        <td>Operator account lacks enough ℏ for the fee.</td>

        <td>
          Top‑up your testnet account with the{" "}
          <a href="https://portal.hedera.com/signup">HBAR faucet</a>.
        </td>
      </tr>

      <tr>
        <td>
          <code>INVALID\_SIGNATURE</code>
        </td>

        <td>Operator key doesn't match operator account</td>
        <td>Verify OPERATOR\_KEY matches your OPERATOR\_ID</td>
      </tr>

      <tr>
        <td>
          <code>INVALID\_ACCOUNT\_ID</code>
        </td>

        <td>Malformed account ID in environment variables</td>

        <td>
          Verify OPERATOR\_ID format is <code>0.0.1234</code>
        </td>
      </tr>

      <tr>
        <td>
          <code>INVALID\_PRIVATE\_KEY</code>
        </td>

        <td>Malformed private key in environment variables</td>
        <td>Verify OPERATOR\_KEY is a valid DER-encoded private key string</td>
      </tr>

      <tr>
        <td>
          <code>KEY\_REQUIRED</code>
        </td>

        <td>Missing key in AccountCreateTransaction</td>

        <td>
          Ensure you call <code>.setECDSAKeyWithAlias(newPublicKey)</code>
        </td>
      </tr>

      <tr>
        <td>
          <code>OPERATOR\_ID and OPERATOR\_KEY must be set</code>
        </td>

        <td>Environment variables not accessible</td>

        <td>
          Check environment variables are set and accessible to your application
        </td>
      </tr>

      <tr>
        <td>
          <code>Cannot read properties of undefined</code>
        </td>

        <td>Missing imports or undefined variables</td>
        <td>Verify all imports are included and variables are defined</td>
      </tr>
    </tbody>
  </table>
</Accordion>

***

## 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

* [Learn more about accounts](/learn/core-concepts/accounts)
* [Create a Token](/native/tutorials/tokens/create-first-token)
* Explore more examples in the SDK repos ([JavaScript](https://github.com/hiero-ledger/hiero-sdk-js), [Java](https://github.com/hiero-ledger/hiero-sdk-java), [Go](https://github.com/hiero-ledger/hiero-sdk-go))

***

🎉 **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

<Card title="Accounts | Hedera" href="/learn/core-concepts/accounts" arrow />
