3

I am writing a program that would monitor changes in balance of a set of Tezos addresses. I did the same for UTXO based coins, and the logic was pretty simple. All of the changes were directly recorded in blocks. I have just started learning Tezos, so I may miss pretty obvious things.

So which operations can change the balance of a Tezos address? Is just retrieving blocks from JSON-RPC enough to see all the changes, or is something like additional processing of smart contracts required?

  • 1
    Instead of searching the blocks one by one to find operations that may have changed the balance of an account, what about using an already existing tool? :) The TzKT API can provide you with a history of balance changes for a given address. – Claude Barde Jul 28 at 12:42
  • One note: the invoice reward allocated to the author of a protocol update that goes up to activation does not get recorded in any operation. The balance of the associated account would get increased by the invoice amount in the first block of the activated protocol but you would not find any trace of it in the json u get through rpc call. It is a limitation of tezos atm. – Ezy Jul 28 at 17:10
5

Operations of the following types can affect account balance:

  • transaction
  • revelation
  • origination
  • delegation
  • endorsement
  • seed_nonce_revelation
  • double_endorsement_evidence
  • double_baking_evidence
  • activate_account

However, there are three additional things which affect account balance as well:

  1. When you bake a block.
  2. When you miss seed_nonce_revelation.
  3. When Tezos protocol is updated.

First two can be extracted from the block metadata, but the last one is not presented in blocks at all, but hardcoded in protocol sources. That's why using RPC is not enough if you do not want to miss anything.

Explorer API is what you actually need. TzKT explorer was the first who introduced "synthetic" operation types for things described above:

This is how you can get complete account history without any gaps.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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