0

I'm trying to create an application that will track balance changes at specified addresses. I want to catch new block validation events and see if there are transactions associated with my addresses. Can this be done with a light sync node (fast/snap) or would a full sync node be required? Please do not suggest using third-party resources such as infura.

3
  • you want to have it all without spending anything , it doesn't work like that. light node won't work. any contract could increase the balance of an account by sending ETH to it, so you will have to trace all the transactions on the blockchain in order to detect balance change. The only way you could do that is 1) using archival node and checking if balance of (your predefined) accounts and this way you would catch the transactions that affect it
    – Nulik
    Feb 1, 2023 at 23:17
  • 2) or having a full node but with an active trace of all the state changes but this node can't go offline or have a failure, because if the failure lasts for more than 128 blocks, you will lose all the states and won't be able to get the balance. Ethereum keeps the last 128 states in memory and prunes states older than currentBlock-128
    – Nulik
    Feb 1, 2023 at 23:18
  • for archival node you need about 20 terabytes of SSD storage for 2023, it is currently 13 TB but by the end of the year you will have about 17TB so you need room for growth
    – Nulik
    Feb 1, 2023 at 23:19

1 Answer 1

0

It depends on how you will track transactions associated with your address, probably you will use some trace capability of Geth:

An archive node retains all historical data back to genesis. It can therefore trace arbitrary transactions at any point in the history of the chain. Tracing a single transaction requires reexecuting all preceding transactions in the same block.

snap synced node holds the most recent 128 blocks in memory, so transactions in that range are always accessible. However, snap-sync only starts processing from a relatively recent block (as opposed to genesis for a full node). Between the initial sync block and the 128 most recent blocks, the node stores occasional checkpoints that can be used to rebuild the state on-the-fly. This means transactions can be traced back as far as the block that was used for the initial sync. Tracing a single transaction requires reexecuting all preceding transactions in the same block, and all preceding blocks until the previous stored snapshot.

If you will simple watch for "to" field in new transactions to know if some transactions is interacting with your contract, a light node is suffice.

1
  • yes, I plan to keep track of the "to" addresses in the new blocks.
    – Galaxy773
    Feb 1, 2023 at 19:04

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.