blog

Introducing MirrorNodeAccountBalanceQuery: The SDK-Native Migration Path for AccountBalanceQuery

October 1, 2026
Luke Forrest
Luke Forrest

Developer Relations Engineer

This post supplements Migrating from AccountBalanceQuery: What You Need to Know, which covers the full deprecation timeline and migration rationale. Read that first for background.

MirrorNodeAccountBalanceQuery is available now 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, giving developers a first-class SDK method to read balances from the mirror node without hand-rolling REST calls or retry logic themselves. Adopting requires no new dependencies or client configuration changes.

Motivation

Mirror nodes have always exposed account 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 every other SDK query. It follows the same convention already established for mirror node queries in the SDK, including MirrorNodeContractCallQuery and MirrorNodeContractEstimateQuery.

What MirrorNodeAccountBalanceQuery Does

MirrorNodeAccountBalanceQuery fetches an account’s HBAR balance from the mirror node’s GET /api/v1/balances endpoint and returns it through the same AccountBalance-style result developers already expect. 

Key properties:

  • Free. No query payment and no HBAR required to execute it.
  • Automatic retries. Transient mirror node errors (5xx responses and network failures) are retried with exponential backoff, using the client’s existing timeout and retry configuration.
  • Flexible ID formats. Accepts shard.realm.num, an EVM address, a public key alias, or a contract ID, all through the same setAccountId method. The mirror node resolves every format natively, extending that same flexibility to account lookups made through the SDK.

Migrating in 60 Seconds

For the JavaScript SDK, the change is two lines:


code window background


// Before
import { AccountBalanceQuery } from "@hiero-ledger/sdk";

const balance = await new AccountBalanceQuery()
    .setAccountId(accountId)
    .execute(client);

console.log(balance.hbars.toString());

// After
import { MirrorNodeAccountBalanceQuery } from "@hiero-ledger/sdk";

const balance = await new MirrorNodeAccountBalanceQuery()
    .setAccountId(accountId)
    .execute(client);

console.log(balance.hbars.toString());


The same pattern applies in Java and Go, using each SDK’s equivalent import. Java developers reading a contract’s balance pass the contract’s shard, realm, and number through AccountId directly, since MirrorNodeAccountBalanceQuery does not expose a separate contract setter:


code window background



// Go
balance, err := hiero.NewMirrorNodeAccountBalanceQuery().
    SetAccountID(accountID).
    Execute(client)



Rust, Swift, and C++ developers can read the same data by calling the mirror node’s GET /api/v1/balances endpoint directly through the client’s mirror network configuration.

Action Required

AccountBalanceQuery’s consensus node endpoint is throttled to zero on testnet and mainnet as of release v0.77 of Consensus Node software, as covered in the companion migration guide linked above, so this migration is not optional for applications that depend on it. Developers currently calling AccountBalanceQuery in the JavaScript, Java, or Go SDKs need to migrate to MirrorNodeAccountBalanceQuery:

  1. Update to a recent SDK release: @hiero-ledger/sdk for JavaScript/TypeScript, or the equivalent Java and Go SDK packages.
  2. Replace AccountBalanceQuery with MirrorNodeAccountBalanceQuery and remove any separate contract-ID setter call, passing contract IDs through setAccountId instead.
  3. Add a short retry or poll, or rely on the transaction receipt, anywhere the application reads a balance immediately after submitting a transaction, since propagation from the Consensus nodes to the Mirror nodes requires a few seconds.

Applications that are not currently calling AccountBalanceQuery are not affected.

SDK Availability

SDKStatus
JavaScript / TypeScriptAvailable now
JavaAvailable now
GoAvailable now
PythonIn progress
Rust, Swift, C++Use the mirror node REST API directly

AccountBalanceQuery is deprecated in favor of MirrorNodeAccountBalanceQuery and the mirror node REST API, as outlined in the companion migration guide linked above.

Next Steps

Update to the latest SDK release for the language in use and try MirrorNodeAccountBalanceQuery against a testnet account to confirm it fits the application’s balance-reading logic before rolling it out more broadly.

Back to Blog

discover

See more articles

November 9, 2026

HIP-1341: Bringing Ethereum’s Pectra Upgrade to Hedera

HIP-1341 brings the execution-layer features of Ethereum’s Pectra upgrade to the Hedera Smart Contract Service, and they have been live on Hedera Mainnet since Release 77 in September 2026. Smart
Read More
October 19, 2026

Meet the Scaffold HBAR Template Bounty winners

Announcing the Scaffold-HBAR Template Bounty winners: templates for multisig governance, limit orders, scheduled keepers and recurring buys, each a command away.
Read More
October 8, 2026

Introducing Hedera Agent Accounts

Hedera Agent Accounts give AI agents programmable, non-custodial spending accounts on Hedera. Set limits and approved merchants on-chain, and your private keys never leave your wallet. This new approach measures
Read More