1

My goal is to list all balance changes for an account on a Substrate-based chain like Acala.

I assumed that on Substrate-based chains all incoming and outgoing values to and from an account would be shown in transfers. However, when I list all the transactions for an account and try to calculate the incoming vs outgoing, it doesn't equal the final balance. For example, with this transaction: https://polkaholic.io/tx/0xad1c3b7704c249937333c746430923facf240d5b859f494b41435e3e4f84b291)

It shows the ACA fund movement, but doesn't show the 38.0228718674 LDOT transferred to 25zCsRMG5kBokWCFaDPuMSYz8nsQX1ZiwHVvfY7bVoJndmhW.

I initially thought some events don't show up in transfers - in this case the "Endowed" event. However, in the same transaction you can see an ACA Endowed event is reflected in the transfers.

Is there a way to determine if a tx type will be included in the transfers? Is there a better way to get the balance changes to an account or some API that provides this data more easily? So far I've only come across Polkaholic and Subscan.

1 Answer 1

1

There are more ways for balance in-/outflow to an account than balance being transferred (e.g. minted balance, burned balance). In addition, it can also be named differently (e.g. withdraw + deposit). What I'm trying to say is that due to different pallets there can be many ways in which balance changes can occur. In your example, the account did not have an account yet, which resulted into the event Endowed, and the LDOT was perhaps minted (I'm not sure) and therefore resulted into the event Deposited (in stead of LDOT being transferred).

If are you interested in the complete history of (asset) balance changes to a given account, I should study the pallets in the runtime and look for all the events that come from some kind of balance in-/outflow (perhaps watch out for duplicate events).

2
  • Amazing thanks that helps a lot - do you know roughly what the most commonly used events are?
    – Aman
    Sep 21, 2023 at 6:30
  • Again, really depends on the pallets present in the runtime. I would say the balances pallet is most used so I would start with those events. Sep 26, 2023 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.