WDK logoWDK documentation

Check Balances

Query native TRX and TRC20 token balances on gas-free Tron wallets.

This guide explains how to check native TRX balances, TRC20 token balances, and read-only account balances.

Native TRX Balance

You can retrieve the native TRX balance using account.getBalance():

Get Native TRX Balance
const balance = await account.getBalance()
console.log('Native TRX balance:', balance, 'sun')

On Tron, values are expressed in sun (1 TRX = 1,000,000 sun).

TRC20 Token Balance

You can check the balance of a specific TRC20 token using account.getTokenBalance():

Get TRC20 Token Balance
const trc20Address = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' // USDT
const trc20Balance = await account.getTokenBalance(trc20Address)
console.log('TRC20 token balance:', trc20Balance)

Read-Only Account Balances

You can check balances for any Tron address without a seed phrase using WalletAccountReadOnlyTronGasfree:

Create Read-Only Account
import { WalletAccountReadOnlyTronGasfree } from '@tetherto/wdk-wallet-tron-gasfree'

const readOnlyAccount = new WalletAccountReadOnlyTronGasfree('TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', {
  chainId: 728126428,
  provider: 'https://api.trongrid.io',
  gasFreeProvider: 'https://gasfree.provider.url',
  gasFreeApiKey: 'your-api-key',
  gasFreeApiSecret: 'your-api-secret',
  serviceProvider: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
  verifyingContract: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH'
})

You can retrieve the native balance from a read-only account using readOnlyAccount.getBalance():

Read-Only Native Balance
const balance = await readOnlyAccount.getBalance()
console.log('Read-only account balance:', balance)

You can also create a read-only account from an existing owned account using account.toReadOnlyAccount().

Next Steps

With balance checks in place, learn how to send TRX.

On this page