It's confusing for me about how the event listener obtains event in time.

Does it mean the listener APP(web3 code) keeps online and just waiting for notificaiton from the contract generating event, or listener APP checks event record written in block data and get the event info itself?

How to understand the procedure about event generation, notificaiton, and so on? Thanks.


Events are written in transaction topics, or event logs. You can see an example for example here: https://etherscan.io/tx/0x6ea1de3dbb191441854f1161bd7b9818a549ce8f7e0b4f0da76bccc78f1473b6#eventlog (an ERC20 token transfer).

So the contract emits the event, the event gets stored inside the transaction and backend systems (programs outside the blockchain) monitor transactions for such events. This is also how web3 operates: it monitors blocks for the right events in the right contract.

  • Why the event be written both in transation topics and event logs? Is it periodical for APP ouside blockchain to read event info from the two sources?Thanks. – Ntydrm Sep 3 '19 at 7:51
  • It's not written in both, it's just called with different names in different places – Lauri Peltonen Sep 3 '19 at 8:00

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.