According to web3 docs, web3.eth.getBlockNumber returns the number of the most recent block.

My question is simple.

Is it safe to assume block's transactions and events are already in the node or can they appear a bit later? Can I, for instance, search for events inside that latest block?

In other words, what is the order of node's actions:

  1. process transactions
  2. update blockNumber


  1. update blockNumber
  2. process transactions
  • 1
    I'm also interested in the answer to your question but in practical terms, I can think of 2 cases where you can't rely on events after getting the block number: 1) If there's been a reorg 2) If you're using infura, because the node (or whatever they have internally) giving you events may be different to the node giving you block numbers – Edmund Edgar May 17 '19 at 10:36
  • Thanks. Where can I learn more about this Infura issue? It seems that's my case – Oleg Kondrakhanov May 17 '19 at 11:50
  • I don't know of a good general explanation of how Infura are set up internally, but for example this has some information about event handling: blog.infura.io/faster-logs-and-events-e43e2fa13773 – Edmund Edgar May 17 '19 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.