Introduction to Ethereum Events

Published by Mario Oettler on

Sometimes, users want to react quickly to certain events in a smart contract automatically. This could be a call of a certain function, or a received payment, or the fulfillment of a certain condition. While full nodes can observe transactions and messages and can trace the state change, it is very difficult to observe every single event in a smart contract.

For example, if a user wants to get notified if the paid token amount is larger than a certain threshold, it is difficult for the full node to check this condition. And light clients (SPV) don’t have this opportunity at all.

In order to facilitate this, Ethereum provides events that can be emitted in a smart contract. If an event is emitted, the event parameters are stored in a certain log history (so-called transaction log). Users (e. g. light clients) can access these logs and filter them according to their needs. In order to do so, they subscribe with a full node for certain events they are interested in. In Lesson 2, topic Events, we learned how to declare events.