Skip to content

    Unit 4 – Structure of Blockchain · 50

    Events

    Events are logs a contract emits during execution. They are recorded with transaction data so external applications and indexers can react to changes, but contracts cannot later read past event logs as ordinary storage.

    Animated diagram

    An event is a public receipt announcing what happened, while storage is the contract’s current filing cabinet

    Function call → State change → Emit event → App listens. Follow the flow to see how events fits into a blockchain system.

    Make the invisible feel visible.

    Events are logs a contract emits during execution. They are recorded with transaction data so external applications and indexers can react to changes, but contracts cannot later read past event logs as ordinary storage.

    Think of it like this

    An event is a public receipt announcing what happened, while storage is the contract’s current filing cabinet.

    Under the hood

    How it works, step by step

    01

    Start with the idea

    Events are logs a contract emits during execution. They are recorded with transaction data so external applications and indexers can react to changes, but contracts cannot later read past event logs as ordinary storage.

    02

    Follow the example

    An escrow contract emits `Released(buyer, amount)` after it transfers the deposit, allowing an interface to refresh its activity feed.

    03

    Notice the benefit

    Events make important contract actions easier for wallets, interfaces and monitoring tools to discover.

    04

    Check the limitation

    Events do not replace state storage and their data is not directly available to other contracts during execution.

    Make it concrete

    Events in practice

    Events in practice

    An escrow contract emits `Released(buyer, amount)` after it transfers the deposit, allowing an interface to refresh its activity feed.

    Key point: Events do not replace state storage and their data is not directly available to other contracts during execution.

    Balanced view

    Advantages & disadvantages

    Advantages

    • Events make important contract actions easier for wallets, interfaces and monitoring tools to discover.

    Disadvantages

    • Events do not replace state storage and their data is not directly available to other contracts during execution.

    Keep these close

    Takeaways & common traps

    What to remember

    • Events are logs a contract emits during execution. They are recorded with transaction data so external applications and indexers can react to changes, but contracts cannot later read past event logs as ordinary storage.
    • Events make important contract actions easier for wallets, interfaces and monitoring tools to discover.
    • Events do not replace state storage and their data is not directly available to other contracts during execution.

    Watch out for

    • Do not assume events guarantees more than its design can prove.
    • Do not ignore the trade-off: Events do not replace state storage and their data is not directly available to other contracts during execution.

    Quick check

    Questions people ask

    Why is events useful?

    Events make important contract actions easier for wallets, interfaces and monitoring tools to discover.

    What is an important limitation?

    Events do not replace state storage and their data is not directly available to other contracts during execution.