0

Using web3 I'm trying to replay all events that have ever happened in order. Reading the docs, a good way to do this seems to be:

  web3.eth.subscribe('logs', { fromBlock: 0}, function() {})
  .on("data", console.log)
  .on("error",console.log)

However, even though it says fromBlock is supported, it only start playing from the current block the blockchain has just synced.

So how would I replay events from the start? I'm pretty sure I shouldn't have to use 'tracing' since this would actually redo all actual calculations on the chain.

0

Do you use a local node ? Because if you use a service it will be limited to 2M5 queries.

Maybe try {fromBlock : 1} ?

2
  • Yeah I’m using a local node – Geert-Jan Jun 4 at 8:19
  • with infura node it's working from me, but I filter event for my smart contract only MyContract.getPastEvents("allEvents", { fromBlock: 100000 }, function (error, events) { }) – GrindCode Jun 5 at 9:50

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.