2

It is possible to monitor for all events that happens on Ethereum network or Binance Smart Chain network (BSC). I know that would be a lot of data however I would like later to filter that data. If yes, thank can it be achieved with help of Web3j library or maybe there is another better one. What about of past data? It is possible to list all events connected with some smart contract in past?

Thanks for advice

2 Answers 2

0

With web3js, you can use web3.eth.subscribe('logs', options [, callback]); (doc) or web3.eth.getPastLogs(options [, callback]) (doc).

Be aware that it is probably not possible to get all the past events of all contracts with web3js using web3.eth.getPastLogs. It would take a lifetime to process on a very powerful machine running a full node.

You may be able to do it for future events by using web3.eth.subscribe.

0

You say you wish to filter this data at a later stage - well, the blockchain being designed as it is actually acts as the perfect record for the data.

If you want to filter logs, use something like Alchemy's eth_getLogs and decode the logs with web3.eth.abi.decodeParamters(). You have a limit per call, however, although with a pro account you'll be able to loop to get past the 10K log / 2K block limit.

Check out Alchemy here

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.