Emitting events in Solidity
Querying events with ethers.js
Filtering by indexed parameters
Indexed event parameters can be used as topics for efficient filtering:null to match any value:
Raw eth_getLogs
For lower-level access or when you don’t have the ABI:Real-time event subscription
Real-time subscriptions require a WebSocket connection, and public WebSocket endpoints are not currently offered on Mainnet or Testnet (see Network endpoints).Query past events over HTTP with
queryFilter, or point the provider at the local WebSocket port on a node you run yourself.Decoding raw log data
If you have raw log data without the ABI:Best practices
- Index only parameters you need to filter on — indexed parameters cost more gas
- Keep event payloads minimal; emit only what consumers need
- Do not use events as the primary storage mechanism — use them for off-chain notification
- Paginate
eth_getLogsqueries in blocks of 1,000–10,000 to avoid timeout errors
Next steps
- Indexing and analytics — build a persistent event index