Events

Smart contracts can broadcast important moments, like a transfer or a deposit, so that external apps (websites, wallets, dashboards) can listen and react in real time. These broadcasts are called events.

Think of events like a public announcement system. When something noteworthy happens inside your contract, it fires an event. Any app watching the blockchain can pick it up and respond: updating a UI, sending a notification, or logging a record.

What Makes Up an Event?

Each event has:

  • A name: describes what happened (e.g., “Transfer”, “Deposit”, “Approval”)
  • Parameters: the values broadcast with the event (e.g., the sender’s address, the amount transferred)
  • Trackable parameters (labeled idx in the editor): parameters marked as searchable, so external apps can efficiently filter for specific values (e.g., “show me all transfers from this address”)

You can have up to 3 trackable parameters per event. Marking a parameter as trackable makes it much faster for apps to search and filter events by that value.

Try It Yourself

The interactive panel below works just like the real editor. Complete each task to explore how events work.

Task 1 of 3 Create a Custom Event

Define an event your contract can broadcast to external apps.

1 Add Event
2 Name it "Deposit"
3 Add a Parameter
4 Name it "amount"
5 Done!
Click + Custom below to create a new event.

Events

Define broadcasts that external apps can listen for

No events defined yet. Use the buttons below to add one.

What You Learned

By completing the tasks above, you explored three key aspects of events:

  • Creating a custom event (like “Deposit”): you define the name and choose which values to broadcast
  • Using a template (like “Transfer”): common event patterns come pre-configured, saving you time
  • Trackable parameters (like “sender”): marking a parameter as trackable lets external apps efficiently search for specific values

Key Concepts

  • Events: Broadcasts your contract sends when something important happens. External apps can listen for these and react.
  • Parameters: The values included in an event. Each parameter has a name and a type (like Number, Wallet Address, or Text).
  • Trackable (Indexed): A parameter marked as searchable (labeled idx in the editor). External apps can efficiently filter events by trackable parameters. You can have up to 3 per event.
  • Templates: Pre-built event patterns (like Transfer and Approval) that follow common standards, saving you from defining them manually.