Skip to main content
This page gets a Node.js application talking to Hedera testnet: SDK install, operator credentials, balance query, and an HBAR transfer.

Prerequisites

  • Node.js 18 or later
  • A Hedera testnet account with ECDSA keys from the developer portal

Step 1: Initialize the project and install the SDK

Enable ES module imports by adding "type": "module" to your package.json:

Step 2: Credentials

Create a .env file (and add it to .gitignore):
OPERATOR_ID is your Hedera account ID (for example, 0.0.1234). OPERATOR_KEY is your account’s ECDSA private key: copy the DER Encoded Private Key (starts with 303...) from the developer portal.

Step 3: Connect, query, transfer

Create index.js:

Step 4: Run it

Expected output:
Look up the transaction on HashScan:
Prefer a local network? Solo runs a full Hedera stack on your machine, no testnet rate limits, no faucet, no resets. See Using Solo with Hiero SDKs to point the SDK at a local Solo network instead of testnet.

What’s next

Create an Account

Generate a new account programmatically and fund it from your operator.

Create a Token

Mint a native HTS token with custom supply and decimals.

Submit to a Topic

Publish a message to HCS for verifiable, ordered audit logs.

SDK Reference

Full API reference on GitHub.
The four Hiero SDKs (JavaScript, Java, Go, Python) share the same API surface, so code translates almost line-for-line between them. Differences are mostly language-idiomatic.