0

I am running my ethereum full node, and from my application, I generate wallets for users on their request.

Now, what I need to do is that whenever a transaction happens on any wallet created using the full node, I need to do some action using the details of the transaction, like update their balance etc.

So, is there any way built into Geth which will execute a callback whenever such a relevant transaction is recieved?

1 Answer 1

0

The JSON RPC API method eth_newFilter https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter can be used to solve your problem. In parameters you can pass a list of addresses to watch. Calling this method will return you a filderId that can then be used for calling eth_getFilterChanges https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges at any point. This will return you an array cointaining all the info you need (see returns).

the web3.js (javascript), web3.j (java) or web3.py (python) are libraries implementing this JSON RPC API

3
  • would this give me the info of both incoming and outgoing transactions on a wallet? Commented Feb 1, 2018 at 12:50
  • from the doc "notify when the state changes". So yes an outgoing transaction changes the state as much as an incoming one. This still has to be confirmed by coding a dummy mockup though
    – salanfe
    Commented Feb 1, 2018 at 13:29
  • Filters read from logs generated by contracts. For example you can track ERC20 balance changes, but you cannot track changes in Ether balances.
    – Ismael
    Commented Apr 28, 2019 at 8:32

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.