1. How are events declared?
Events are defined by the “event” keyword and can be fired within a function body.
2. How can we emit events?
To emit an event (invoke it inside a function body) we use the “emit” keyword followed by the eventname.
3. How and where do we listen for events?
Inside the contract we define what functions have to invoke what event. Outside the contract (in the
programming language of the app you want to implement using the contract) you can watch for those
First we define the event:
var <eventname> = <variable used for contract>.<eventname inside contract>()
Then we can watch for the event:
<do actions if no errors occurred>;
<do actions if errors occurred>;