[Solved]How to track the accurate AEX-9 token balances in real time?

AEX-9 token might be an important role in the ecosystem. Now we can deploy an AEX-9 token rapidly, just ONE-CLICK, but tracking the AEX-9 token balances is a problem for me.

There was a reliable way to track the accurate AEX-9 token balances without calling the contracts: reading the store data directly through contract’s store API. But with the increasing size of the store data, the reading time becomes very long, so the API was removed: Remove v2/contracts/{hash}/store endpoint by hanssv · Pull Request #3115 · aeternity/aeternity · GitHub.

I tried two other ways to track the balances in real time:

  1. Tracking each AEX-9 related tx. It will not produce extra onchain data, but the reliability relies on the accuracy of the transactions record.
  2. Calling the balances() function. The result is reliable, but it will generate extra onchain data, the data size should be very big with high frequency callings of contracts.

Is there any other way to update the AEX-9 token balances accurately and frequently?

Regards,

Liu Yang

3 Likes

You can track it easily by watching the chain transactions and look for contract events regarding AEX-9 and only fetch the balances for the corresponding accounts.

Statically (dry-run) calling the balances() will not generate any extra onchain data, you can call this without any limits.

3 Likes

Thanks very much!

It seems that it is what I want exactly!

I will try later.

2 Likes