3

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.

2
  • The OP asked for help on JAVA WEB3J. Not Javascript. Commented Aug 8, 2024 at 0:10
  • You're right. Both answers including mine are for web3js. Commented Sep 11, 2024 at 18:31
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

1
  • The OP asked for help on JAVA WEB3J. Not Javascript. Commented Aug 8, 2024 at 0:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.