Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsTRONTRON HTTP API

wallet/getaccountbalance - Get TRON Account Bal...

Retrieve the native TRX balance of a TRON account at a specific block height. This endpoint returns TRX balance only — it does not return TRC-10 or TRC-20 token balances.

TRON RPC endpoint: endpoint URLs, plans and pricing.

Retrieve the native TRX balance of a TRON account at a specific block height. This endpoint returns TRX balance only — it does not return TRC-10 or TRC-20 token balances.

Use Cases

wallet/getaccountbalance is useful for:

  • Wallet Applications - Display TRX balance at a given block height
  • Payment Verification - Confirm TRX payment receipt at a specific block

For Token Balances

This endpoint does not return token balances. Use the following approaches instead:

GoalEndpoint / Approach
Current TRX balancewallet/getaccount
Current TRC-20 balancewallet/triggerconstantcontract calling balanceOf(address) on the token contract
Historical TRX balancewallet/getaccountbalance
Historical TRC-20 balanceNot natively supported by TRON full nodes; use indexed services (TronScan API, Bitquery, Covalent)
JSON-RPC request
{
  "account_identifier": {
    "address": "TRX6Q82wMqWNbCCmJPLz9mR8AZwqvUU2pN"
  },
  "block_identifier": {
    "number": 58234567
  },
  "visible": true
}

Implementation Examples

Response Examples

Successful Response

JSON
{
  "balance": 1453878299614,
  "block_identifier": {
    "hash": "0000000004dd7431...",
    "number": 81622065
  }
}

Zero Balance Response

JSON
{
  "balance": 0,
  "block_identifier": {
    "hash": "0000000004dd7431...",
    "number": 81622065
  }
}

Common Use Cases

1. TRX Balance Display

JavaScript
async function displayBalance(address) {
  const result = await getAccountBalance(address);
  // Balance is in SUN (1 TRX = 1,000,000 SUN)
  const trx = result.balance / 1_000_000;
  
  return {
    display: `${trx.toFixed(6)} TRX`,
    blockHeight: result.block_identifier.number,
  };
}

2. Payment Confirmation

JavaScript
async function confirmPayment(address, expectedAmount, minConfirmations = 19) {
  const balance = await getAccountBalance(address);
  const currentBlock = balance.block_identifier.number;
  
  // Check if payment received (expectedAmount in SUN)
  const received = balance.balance >= expectedAmount;
  
  // Get latest block to check confirmations
  const latestBlock = await getLatestBlock();
  const confirmations = latestBlock.number - currentBlock;
  
  return {
    received,
    balanceSun: balance.balance,
    balanceTrx: balance.balance / 1_000_000,
    confirmations,
    confirmed: received && confirmations >= minConfirmations
  };
}

3. Balance Change Detection

JavaScript
class BalanceMonitor {
  constructor(apiKey, address) {
    this.apiKey = apiKey;
    this.address = address;
    this.lastBalance = null;
  }
  
  async checkForChanges() {
    const current = await getAccountBalance(this.address);
    
    if (this.lastBalance === null) {
      this.lastBalance = current.balance;
      return { changed: false, balanceSun: current.balance };
    }
    
    const changed = current.balance !== this.lastBalance;
    const difference = current.balance - this.lastBalance;
    
    this.lastBalance = current.balance;
    
    return {
      changed,
      balanceSun: current.balance,
      differenceSun: difference,
      differenceTrx: Math.abs(difference) / 1_000_000,
      direction: difference > 0 ? 'received' : 'sent',
    };
  }
}

Best Practices

  1. Cache Results - Balance queries can be cached for 3 seconds
  2. Batch Requests - Query multiple accounts in parallel
  3. Monitor Changes - Use block height to detect balance changes
  4. Validate Addresses - Check address format before querying

Related Methods

  • wallet/getaccount - Get detailed account information (including current TRX balance)
  • wallet/getaccountresource - Get resource details
  • wallet/validateaddress - Validate address format
  • wallet/getaccountnet - Get bandwidth usage

Need help? Contact support or check our TRON documentation.

wallet/getaccount

Get comprehensive TRON account information including TRX balance, resources, TRC20 tokens, and account permissions via Dwellir's optimized RPC endpoint.

wallet/getaccountresource

Get TRON account bandwidth and energy resources for transaction fee optimization. Monitor resource usage and manage stake efficiently with Dwellir RPC.

On this page

Use CasesFor Token BalancesImplementation ExamplesResponse ExamplesSuccessful ResponseZero Balance ResponseCommon Use Cases1. TRX Balance Display2. Payment Confirmation3. Balance Change DetectionBest PracticesRelated Methods