1

I am writing a program that would monitor changes in balance of a set of ethereum addresses. I did the same for UTXO based coins, and the logic was pretty simple. All of the changes were directly recorded in blocks. But ethereum appears to be more complicated. Which operations I have to monitor to be sure I won't miss anything? It is important that I have to monitor changes of balance, not the balance itself.

Operations that are capable of changing balance, that I found:
1. Basic transactions on the blockchain level
2. Block rewards for mining
3. Smart contract internal transactions

Is there anything else that I have to be aware of? When ETH 2.0 arrives, will the staking reward format be different from the current types of balance update?

1
  • 1
    Sounds like you've covered all scenarios. I would split #1 into: 1.1. Ether-transfer from the account. 1.2 Ether-transfer to the account. And I would change #3 to: Gas fee on transactions from the account (which basically includes #1.1, so perhaps there's a better way to classify the whole thing). – goodvibration Jun 4 '20 at 11:52
2

I would add SELFDESTRUCTs to the list. They are quite unique, as they can transfer ether to a smart contract without executing its code. Also, I would add special one-time transfers performed by EIP-779 at block 1920000.

0

You can try making a list of operations, but the most robust would be to run an instrumented node that processes every transaction as mentioned for example in How to get contract internal transactions

The third item in your question will already require it.

As @Mikhail noted, SELFDESTRUCT is also an important one.

Another case I can think of that you are missing is sending ether along with contract creation.

So rather than trying to create a "list of operations", it's probably most robust to have an instrumented node processing every transaction, than try to figure out all the edge cases. There might be scenarios with CREATE2 (along with SELFDESTRUCT). (There's also the irregular state change mentioned by @Mikhail.)

If the attempt to have a "list of operations" is to be able to check statically without processing transactions, there's probably a theory that the EVM's pseudo Turing Completeness means it's not possible to do statically: you have to run EVM code to determine if it actually did change the balance of an address.

1
  • ETH 2.0 doesn't have addresses yet. This can be updated in the future. – eth Jun 5 '20 at 19:35

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.