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

Prerequisites

  • Go 1.21 or later
  • A Hedera testnet account with ECDSA keys from the developer portal

Step 1: Initialize the module and install the SDK

Step 2: Credentials

Create a .env file (and add it to .gitignore):
OPERATOR_ID is your Hedera account ID. OPERATOR_KEY is the DER-encoded ECDSA private key; use the HEX Encoded Private Key value from the developer portal.

Step 3: Connect, query, transfer

Create main.go:

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.