What is an Event?

Are they only used in Solidity?

How are events defined?

How are events initiated?

Is there a standard term for an event's invocation (do you say an event "happened", "was called", "was invoked","triggered")?

Where in the block header does an Event end up?


How to implement events in solidity

Where do contract event logs get stored in the Ethereum architecture?


3 Answers 3


The blockchain is a list of blocks which are fundamentally lists of transactions. Each transaction has an attached receipt which contains zero or more log entries. Log entries represent the result of events having fired from a smart contract.

In the Solidity source code, to define an event, you mark it thus by preceding it with the event keyword (similar in usage to the function keyword). You then call or fire the event in the body of whatever function you wish to cause to generate the event. (I doubt there is a standard wording for it). You may fire events from any function using the emit keyword.

Someone can probably add information on how to 'listen' for events in your DAPP. It uses the filtering functionality of Web 3.0.

Check out the Ethereum Ontology which was recently published by Johannes Pfeffer for a very thorough explanation of many Ethereum concepts.

  • 1
    Is it kind of like the JavaScript event which can be triggered with something happening i.e event based?
    – user17001
    Commented May 20, 2018 at 17:56
  • 1
    Yes. It is. Filler. Commented May 20, 2018 at 21:44
  • 3
    @FahadUddin In it's most basic form, an event is EXACTLY printing a log. Therefore it is kind of like Javascript's console.log. That's it, nothing more, nothing less. In Solidity it has zero other purpose than logging the event to the blockchain. However, you can listen to events in real-time from outside code so you can use events as a sort of push notification.
    – slebetman
    Commented Jun 21, 2018 at 3:42
  • @slebetman is it possible to revert() emitted events? Commented Jul 23, 2019 at 17:42
  • If the transaction reverts no events are generated. If the transaction does not revert , the event is part of the chain immutably. You can’t get it back. Commented Jul 23, 2019 at 18:42

Events are dispatched signals the smart contracts can fire. DApps, or anything connected to Ethereum JSON-RPC API, can listen to these events and act accordingly. Event can be indexed, so that the event history is searchable later.

An example event from a wallet contract is:

event Deposit(address from, uint value);

The application (dapp, web application, other) interested in deposits to a wallet contract would listen to this event. The application would connect to Ethereum node over JSON-RPC and either watch (wait) for the event to happen or read all the past events to sync up the application internal state with Ethereum blockchain.

  • Just a side question, can emited events to log be reverted? Commented Jul 23, 2019 at 20:39
  • The whole chain state rolls back on a reorganisation or none of it rolls back. Individual events cannot be reverted. Commented Jul 24, 2019 at 7:51
  • I mean if I use revert() it will roll back events like Transfer() right? Commented Jul 24, 2019 at 10:20
  • Yes, it will roll back with everything else. There can be only one truth and transactions either completely full or none of it - atomic manner. Commented Jul 24, 2019 at 14:19

The yellowpaper (version 7e819ec - 2019-10-20) section 6.1 Substate includes a description of:

indexable ‘checkpoints’ in VM code execution that allow for contract-calls to be easily tracked byonlookers external to the Ethereum world (such as decentralised application front-ends).

The yellowpaper preceded the event terminology, but an event is a way that DApps can get information at a specific point during smart contract (EVM) code execution. Whenever the EVM encounters a LOG opcode, Ethereum nodes emit an event that DApps and external processes can be notified of and access.

In Solidity, an emit of an event gets compiled to LOG opcodes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.