Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

Events (Smart Contract Logging)

1 min read
Pronunciation
[ee-vents smart kon-trakt log-ing]
Analogy
Events are like headlines in a newspaper—they summarize important occurrences for readers (off‑chain listeners) without storing them in the main story.
Definition
EVM logs emitted by contracts to record indexed data and facilitate efficient off‑chain monitoring and filtering.
Key Points Intro
Events enhance transparency via:
Key Points

Indexed topics: Up to 3 indexed parameters for efficient filtering.

Data field: Stores non‑indexed event arguments.

Gas efficiency: Cheaper than storage writes for audit trails.

Off‑chain listeners: Tools like The Graph subscribe to events.

Example
``` event Transfer(address indexed from, address indexed to, uint256 value); function transfer(...) { ...; emit Transfer(msg.sender, to, amt); } ```
Technical Deep Dive
When `emit` is called, the EVM creates a log entry with `topics[0]=keccak256(eventSignature)`, `topics[1..]` for indexed args, and `data` for others. Logs are stored in the receipt trie, not contract storage, and do not affect state root. Clients retrieve logs via `eth_getLogs` RPC.
Security Warning
Relying solely on events for critical state can be unsafe—events are not accessible to contracts and may be pruned in archive nodes.
Caveat
Events are not accessible on‑chain; do not use them for contract logic decisions.

Events (Smart Contract Logging) - Related Articles

No related articles for this term.