Skip to content

eth_getLogs

Returns an array of all logs matching a filter object. The primary tool for indexing on-chain events.

Filter options. At least one criterion should be provided.

FieldTypeDescription
fromBlockstringStart of the block range. Block number in hex or a block tag. Pass "pending" on a Flashblocks endpoint to include pre-confirmed logs. Defaults to "latest".
toBlockstringEnd of the block range. Block number in hex or a block tag. Defaults to "latest".
addressstring | arrayA contract address or array of addresses to filter by. Optional.
topicsarrayArray of 32-byte topic filters. Each position can be null (match any), a single topic hex string, or an array of hex strings (match any in the array). Position 0 is typically the keccak256 hash of the event signature. Optional.
blockHashstringRestricts logs to the block with this hash. When supplied, fromBlock and toBlock are ignored. Optional.

result (array of log objects):

FieldTypeDescription
addressstring20-byte address of the contract that emitted the log.
topicsarrayArray of 0–4 indexed 32-byte topics. Topic 0 is typically the event signature hash.
datastringABI-encoded non-indexed event parameters.
blockNumberstringBlock number in which this log was emitted (hex).
transactionHashstring32-byte hash of the transaction that emitted this log.
transactionIndexstringIndex of the transaction in the block (hex).
blockHashstring32-byte hash of the block.
logIndexstringThe log’s index position within the block (hex).
removedbooleantrue if the log was removed due to a chain reorganization.
Terminal window
curl https://mainnet.base.org \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x12ced00",
"toBlock": "0x12ced28",
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000d3cda913deb6f4967b2ef66ae97de114a83bcc01",
"0x0000000000000000000000004200000000000000000000000000000000000006"
],
"data": "0x0000000000000000000000000000000000000000000000000000000005f5e100",
"blockNumber": "0x12ced28",
"transactionHash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
"transactionIndex": "0x0",
"blockHash": "0x3a4e8c5d7f2b1a6e9d0c4f8b3e7a2d5c8f1b4e7a0d3c6f9b2e5a8d1c4f7b0e3",
"logIndex": "0x0",
"removed": false
}
]
}