Skip to content
RED SAGSkills
easyBlockchain Developer interview question

What are events in Solidity, and how do you use them in a real project?

What the interviewer wants to hear

  • Events write logs to the transaction receipt, cheaper than storage
  • Contracts cannot read logs; they are for off-chain consumers
  • Up to three indexed parameters can be filtered efficiently
  • Frontends and indexers like The Graph use them for history and updates
  • Emit an event for every important state change

Model answer

An event is a way for a contract to write a log entry into the transaction receipt, for example Transfer(from, to, amount). Logs are much cheaper than storage, but contracts cannot read them, so they are meant for off-chain tools. Up to three parameters can be marked indexed, which puts them in topics so nodes can filter by them, such as all transfers to one address. In a real project I emit an event for every important state change, like deposits, withdrawals, role changes and parameter updates. The frontend listens to them for live updates, and an indexer such as a subgraph or a custom service stores them in a database for history and analytics. Good events are also important for monitoring and incident response, because alerts usually watch for unusual events.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Blockchain Developer questions