Overview
Hedera accounts are first-class entities (shard.realm.num), hold HBAR + token associations, and support richer key structures than a single secp256k1 EOA. This skill maps SDK flows to official docs for Accounts and SDK guides under Accounts and HBAR.
When to use this skill
- Generating ED25519 vs ECDSA(secp256k1) keys for HTS vs EVM interoperability decisions.
- Funding new accounts via
CryptoTransfer/TransferTransaction. - Rotating keys with
AccountUpdateTransactionwhile preserving account ID. - Designing m-of-n multisig using
ThresholdKey+KeyList.
Prerequisites
- Completed environment setup (
OPERATOR_ID/OPERATOR_KEYin.env). - Testnet HBAR for account creation fees + initial balance transfers.
Workflow
Choose key type
- ED25519 — default native curve; compact signatures.
- ECDSA — aligns with many Ethereum workflows; required for some EVM-centric signing pipelines.
Generate with
PrivateKey.generateED25519()orPrivateKey.generateECDSA()(Generate a new key pair).Create an account — minimal pattern:
const newKey = PrivateKey.generateED25519(); const tx = await new AccountCreateTransaction() .setKey(newKey.publicKey) .setInitialBalance(Hbar.fromTinybars(50_000_000)) // 0.5 ℏ example .freezeWith(client); const signTx = await tx.sign(operatorKey); const rx = await signTx.execute(client); const receipt = await rx.getReceipt(client); const newId = receipt.accountId;Reference implementation: scripts/create-account.js.
Query info / balance
AccountBalanceQuery— hbars + token balances.AccountInfoQuery— keys, memo, auto-renew period, proxies.
Update account
AccountUpdateTransaction— rotate keys, alter memo, extend expiration fields per network rules.
See scripts/update-keys.js — requires
TARGET_ACCOUNT_IDandOLD_KEY_DER.Multisig
- Compose
KeyListwith N keys; wrap withThresholdKeyspecifyingthresholdM.
Example reference: scripts/multisig-account.js.
- Compose
Delete account
AccountDeleteTransactionremoves account when remaining funds moved per docs — verify latest constraints under Delete an account.
Examples
Example 1
“Create a treasury account with ED25519 keys and 2 ℏ starting balance on testnet.”
Execute create workflow with setInitialBalance(Hbar.from(2)), securely persist private key material offline.
Example 2
“We need 2-of-3 ops keys for our treasury.”
Build ThresholdKey.of(2, KeyList.of(k1, k2, k3)), document signer roster, test partial signatures failure cases.
Example 3
“Rotate our admin key after a contractor offboarding.”
Use AccountUpdateTransaction with old key signing plus new key material; validate with AccountInfoQuery.
Troubleshooting
| Code / symptom | Cause | Mitigation |
|---|---|---|
INVALID_SIGNATURE |
Missing required signatures for multisig | Collect threshold signatures |
INSUFFICIENT_PAYER_BALANCE |
Operator cannot fund initial balance | Refill operator |
ACCOUNT_ID_DOES_NOT_EXIST |
Wrong network / stale ID | Confirm network in Client |
| EVM mismatch | Treating ECDSA account as if it were ETH address without alias handling | Read Smart Contract Addresses |
References
- Local: references/account-apis.md, references/key-types.md, references/multisig-patterns.md
- Docs: Cryptocurrency Accounts protobuf reference, Java SDK recipes mirror JS closely.