Learn about events in Solidity.

Events in Solidity are a means for capturing and logging specific occurrences or state changes within a contract. Events are contracted inheritable components that allow essential information to be communicated to external programs. They are especially important for signaling changes in the state of the contract, allowing external applications to respond appropriately.

Event creation

Events are declared using the event keyword, followed by an identifier, a parameter list, and a semicolon. The parameters capture relevant values for conditional logic or informational purposes. Events are invoked within the functions of a contract. They are triggered using the emit keyword, followed by the event name and the necessary arguments.

Get hands-on with 1200+ tech skills courses.