0PricingLogin
Web3 & DApp Development Fundamentals · Lesson

Declaring Events

Emit on-chain logs.

What Are Events?

Events let a smart contract write entries to the blockchain's log. These logs are a cheap way to record that something happened and are the primary channel for contracts to communicate with off-chain applications.

Front-ends, indexers, and analytics tools all listen for events.

Declaring an Event

You declare an event with the event keyword and a list of typed parameters. The declaration defines the event's shape.

<code>event Transfer(address from, address to, uint256 amount);</code>

All lessons in this course

  1. Declaring Events
  2. Indexed Parameters
  3. Listening for Events
  4. Events vs Storage
← Back to Web3 & DApp Development Fundamentals