Overview
This skill walks developers through a safe, repeatable environment bootstrap for Hedera testnet first, then documents mainnet differences. It aligns with official Hiero SDK patterns (JavaScript, Java) and Mirror Node REST usage documented at docs.hedera.com.
When to use this skill
- Creating accounts via Hedera Portal or programmatic flows later.
- Requesting testnet HBAR from the official faucet (linked from docs — verify current URL on docs.hedera.com — Hedera Testnet Faucet).
- Choosing ED25519 DER vs hex ECDSA private key encodings for
OPERATOR_KEY. - Wiring
.envfor scripts and CI without leaking keys.
Prerequisites
- Node.js 18+ for JS samples (
npm installat repo root). - A Hedera Portal account (email verification).
- For Mirror REST checks: network reachability to public mirror hosts (corporate proxies may block).
Workflow
Create / recover operator credentials
- Register at portal.hedera.com. Download or copy testnet key material for an operator account.
- Never commit keys. Store only in
.envor a secrets manager.
Fund testnet account
- Use the official testnet faucet per current docs (portal UI often embeds the link). Confirm balance in a block explorer or via SDK/Mirror.
Choose network in
.envHEDERA_NETWORK=testnet # testnet | previewnet | mainnet OPERATOR_ID=0.0.12345 OPERATOR_KEY=302e020100301006072a8648ce3d020106052b8104000a042204... MIRROR_REST_URL=https://testnet.mirrornode.hedera.comSee references/env-vars.md for the full matrix.
Install Hiero JavaScript SDK (project-local):
npm install @hashgraph/sdk dotenvJava projects: use Gradle/Maven coordinates from hashgraph/hedera-sdk-java README — mirror this guidance when users pick Java.
Verify consensus connectivity
Run from repository root after
npm install:node plugins/hedera-skills/skills/hedera-environment-setup/scripts/verify-connection.jsThis executes
AccountBalanceQueryagainst the operator account — proving signing keys matchOPERATOR_ID.Verify Mirror Node REST
The same script performs an HTTP GET to
/api/v1/balances?account.id=<OPERATOR_ID>(seereferences/endpoints.mdfor hostnames).Mainnet readiness gate
Before mainnet: key custody policy, funding source, optional multisig / custody/HSM, fee estimation from network fees API. Default all tutorials to testnet.
Examples
Example 1 — student on Udemy
“I created a Portal account; how do I set
.envand prove my SDK works?”
Guide them through sections Workflow steps 3–6 and run verify-connection.js. Explain DER-encoded ED25519 keys often start with 302e0201….
Example 2 — switching networks
“I need previewnet for a HIP prototype.”
Set HEDERA_NETWORK=previewnet, update MIRROR_REST_URL to previewnet mirror base URL from references/endpoints.md, rebuild Client.forPreviewnet().
Example 3 — CI secrets
“How do I load keys in GitHub Actions safely?”
Use encrypted secrets (OPERATOR_KEY), inject env at runtime, never echo secrets in logs; rotate keys if leaked.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
INVALID_SIGNATURE |
Wrong key for OPERATOR_ID, or mixed ED25519/ECDSA |
Regenerate key export from Portal; ensure signing uses same curve |
INSUFFICIENT_PAYER_BALANCE |
Unfunded operator | Use faucet (testnet) or transfer HBAR |
| Mirror HTTP 404 / empty | Wrong mirror host for network | Align MIRROR_REST_URL with network |
| TLS / proxy errors | Corporate MITM | Trust store update or allowlist mirror hosts |
References
- Bundled: references/endpoints.md, references/env-vars.md, references/sdk-compatibility.md
- Official: Networks — Testnet, Build Your Hedera Client, Mirror Node REST API
- Portal: portal.hedera.com, builder hub hedera.com/start-building