What is Event Log?

1 min read Updated

An event log is a record emitted by a smart contract during transaction execution — providing a gas-efficient way to record data that's accessible to off-chain applications but not to other smart contracts.

WHY IT MATTERS

Events are smart contracts' communication channel to the outside world. When a contract emits an event (like Transfer(from, to, amount)), it's recorded in the transaction receipt's logs. Off-chain applications, indexers, and frontends monitor these events.

Events are cheaper than storage (~375 gas per byte in event data vs 20,000 gas per 32-byte storage write). This makes them ideal for recording historical data that doesn't need to be accessed on-chain.

The ERC-20 Transfer event, for example, is how wallets track token movements, block explorers display transfers, and analytics platforms calculate volumes. Events are fundamental to the dApp data layer.

FREQUENTLY ASKED QUESTIONS

Can smart contracts read event logs?
No. Events are recorded in transaction receipts but are not accessible to on-chain code. They're designed for off-chain consumption. If you need on-chain access, use storage variables.
What are indexed event parameters?
Parameters marked 'indexed' (up to 3 per event) can be filtered efficiently. You can subscribe to Transfer events for a specific address, for example. Non-indexed parameters require scanning all events.
How do I listen for events?
Using WebSocket subscriptions (real-time) or polling with eth_getLogs (batch). Libraries like ethers.js and viem provide event listener abstractions. The Graph indexes events for queryable access.

FURTHER READING

Enforce policies on every tool call

Intercept is the open-source MCP proxy that enforces YAML policies on AI agent tool calls. No code changes needed.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.