Tron Balance & Balance Updates API
In thise section we will see how to monitor real-time balance changes across the Tron blockchain
Subscribe to Balance Updates of a Particular Wallet
The query will subscribe you to real-time updates for balance changes on the Tron blockchain, providing a continuous stream of data as new transactions are processed and recorded. Here we have used address 0xacD03D601e5bB1B275Bb94076fF46ED9D753435A
. You can find the query here
subscription {
Tron {
BalanceUpdates(
where: {BalanceUpdate: {Address: {is: "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"}}}
) {
Currency {
Name
}
BalanceUpdate {
Address
Amount
Type
}
Block {
Time
}
Transaction {
Hash
}
}
}
}
Balance of an Address on Tron
{
Tron(dataset: combined, aggregates: yes) {
BalanceUpdates(
where: {BalanceUpdate: {Address: {is: "TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf"}}}
orderBy: {descendingByField: "balance"}
) {
Currency {
Name
}
balance: sum(of: BalanceUpdate_Amount, selectWhere: {gt: "0"})
}
}
}
Top Token Holders of a token
This query fetches you the top 10 token holders of the token TXL6rJbvmjD46zeN1JssfgxvSo99qC8MRT
. Check out the query here.
query MyQuery {
Tron(dataset: combined) {
BalanceUpdates(
limit: {count: 10}
orderBy: {descendingByField: "balance"}
where: {Currency: {SmartContract: {is: "TXL6rJbvmjD46zeN1JssfgxvSo99qC8MRT"}}}
) {
balance: sum(of: BalanceUpdate_Amount, selectWhere: {gt: "0"})
BalanceUpdate {
Address
}
}
}
}