Returns event logs that match specified filter criteria.
eth_getLogs
JSON-RPC method returns event logs that match specified filter criteria. This method is essential for retrieving smart contract events, monitoring contract activity, and building event-driven applications on the blockchain.
address
(string or array, optional) — Contract address(es) to filter logs fromfromBlock
(string, optional) — Starting block number in hexadecimal (default: "latest"
)toBlock
(string, optional) — Ending block number in hexadecimal (default: "latest"
)topics
(array, optional) — Array of topic filters for event matchingblockhash
(string, optional) — Block hash to filter logs from (alternative to block range)"0x1234..."
["0x1234...", "0x5678..."]
fromBlock
and toBlock
define the range"latest"
, "earliest"
, "pending"
, or hex block numbersnull
(any value), string (exact match), or array (multiple options)address
— Contract address that emitted the logtopics
— Array of indexed event parameters (including event signature)data
— Non-indexed event parameters as hexadecimal stringblockNumber
— Block number containing the logblockHash
— Hash of the block containing the logtransactionHash
— Hash of the transaction that generated the logtransactionIndex
— Index of the transaction in the blocklogIndex
— Index of the log in the transactionremoved
— Boolean indicating if log was removed due to chain reorganizationtopics[0]
— Event signature hash (keccak256 of event signature)topics[1-3]
— Indexed event parameters (if any)data
— Non-indexed parameters (ABI-encoded)eth_getLogs
method is essential for applications that need to:
eth_getLogs
supports up to 4 topics and a maximum query range of 50 blocks. For larger ranges, use chunking to process blocks in batches of 50 or fewer.Successful response with matching event logs
The response is of type object
.