The tron.assets.trc20_balances contains block-level balances of TRC20 tokens.

Each entry in the model corresponds to a specific event/transaction that causes a balance change in a particular asset at the block level. This means a new data entry is only created when a transaction alters an asset’s balance at the block level.

  • For example, if a wallet receives 1 USDC in 2020 and experiences no further changes until yesterday, the model will have two entries: one for the initial receipt in 2020 and another for the recent change.

Model Caveats

The tron.assets.trc20_balances dataset is derived by calculating the net effect of all token transfers for each account, specifically by summing all incoming transfers (credits) and subtracting all outgoing transfers (debits). This approach is used as the Tron blockchain does not support point-in-time balance queries for TRC20 contracts.

As a result, the model is subject to the following caveats that will result in discrepancies in the balances:

  • Balance Changes Without Transfers: Certain operations may modify token balances without generating a transfer event. This can occur through direct contract interactions that adjust balances internally, bypassing the standard transfer log mechanism. Some older TRC20 contracts or legacy blocks may not emit standard transfer events. As a result, balances from these contracts might not be accurately captured.

  • Rebasing Tokens: Rebasing tokens automatically adjust their total supply, which can impact individual balances without explicit transfer events. This can lead to discrepancies in balance calculations that rely solely on transfer events.

  • Null Balances: Zero address T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb will show negative balances for most TRC20 tokens due to the way the event logs represent zero address as the sender of assets during token mints, despite the address not holding the assets previously.

Sample Query

Sample

select * from tron.assets.trc20_balances

where address = 'TXFBqBbqJommqZf7BV8NNYzePh97UmJodJ'

and token_address = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' -- USDT Token Address

order by block_number desc 

Table Columns

Column NameDescriptionExampleColumn Name
addressAddress of the account.TYE218dMfzo2TH348AbKyHD2G8PjGo7ESS
token_addressToken address of the TRC20 token.TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8
token_name Name of the TRC20 token.USD Coin
token_symbolToken symbol of this token.USDC
balanceBalance of this TRC20 token, normalized by the decimal points defined in the TRC20 token contract. For example, USDC has 6 decimals, so this value is the raw_balance divided by 10^6.1,101.95
raw_balanceBalance of tokens (unnormalized)1101950000
usd_valueThe amount of tokens, in $USD.1,101.95
usd_exchange_rateThe exchange rate used to calculate the usd_value.1
block_timestampThe timestamp of the block that that resulted in the balance.2021-07-04 11:29:30
block_numberThe number of the block that resulted in the balance.31,641,759
block_hashThe hash of the block that resulted in the balance.0x0000000001e2d09ff8d7322804797a046afb97433cfedc15f46b057df5c47dee