- Hedera has introduced MirrorNodeAccountBalanceQuery in the JavaScript, Java, and Go Hiero SDKs as a native replacement for the deprecated AccountBalanceQuery
- The new method fetches HBAR balances from the mirror node REST API for free, with automatic retries and support for multiple account ID formats
- Migration requires only a two-line code change—replacing AccountBalanceQuery with MirrorNodeAccountBalanceQuery—and no new dependencies
- Applications that do not use AccountBalanceQuery are unaffected; the consensus node endpoint is throttled to zero as of release v0.77
Hedera has released MirrorNodeAccountBalanceQuery in the JavaScript, Java, and Go Hiero SDKs, giving developers a native way to read an account’s HBAR balance from the Mirror Node REST API without leaving the SDK’s familiar query interface. The new method replaces AccountBalanceQuery, which is now deprecated and its consensus node endpoint throttled to zero on testnet and mainnet as of v0.77 of the Consensus Node software.
Mirror nodes have always exposed balance data through their REST API, and SDK clients already hold a connection to a mirror network. MirrorNodeAccountBalanceQuery extends the SDK’s native query interface to that data using the same fluent, typed pattern developers use for other SDK queries, following conventions established for MirrorNodeContractCallQuery and MirrorNodeContractEstimateQuery.
Key properties include zero cost—no query payment and no HBAR required—along with automatic retries for transient mirror node errors using exponential backoff and the client’s existing configuration. The query accepts multiple ID formats including shard.realm.num, EVM address, public key alias, or contract ID, all through the same setAccountId method, with mirror node resolution handling every format natively.
Migration is straightforward: developers update to a recent SDK release, replace AccountBalanceQuery with MirrorNodeAccountBalanceQuery, and pass contract IDs through setAccountId instead of a separate setter. For JavaScript, the change is two lines as shown in the original migration guide, and the same pattern applies in Java and Go using each SDK’s equivalent import.
Applications that read a balance immediately after submitting a transaction should add a short retry or poll, since propagation from consensus nodes to mirror nodes requires a few seconds. Developers can consult the SDK reference and Mirror Node REST API documentation for further details, while the Ledger/sdk”>@hiero-ledger/sdk package on npm provides the latest JavaScript release.
✅ Follow BITNEWSBOT on Telegram, Facebook, LinkedIn, X.com, and Google News for instant updates.
