Returns an array of all logs matching a given filter object.
Parameters
object
required
The filter options object.
Show Filter object properties
Show Filter object properties
string
Integer block number, or “latest” for the last mined block or “pending”, “earliest” for not yet mined transactions.
string
Integer block number, or “latest” for the last mined block or “pending”, “earliest” for not yet mined transactions.
string | array
Contract address or a list of addresses from which logs should originate.
array
Array of 32 Bytes DATA topics. Topics are order-dependent.
string
Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash.
Returns
array
Array of log objects matching the filter.
Show Log object properties
Show Log object properties
boolean
True when the log was removed, due to a chain reorganization. False if it’s a valid log.
string
Integer of the log index position in the block. null when its pending log.
string
Integer of the transaction index position log was created from. null when its pending log.
string
Hash of the transaction this log was created from. null when its pending log.
string
Hash of the block where this log was in. null when its pending.
string
The block number where this log was in. null when its pending.
string
Address from which this log originated.
string
Contains the non-indexed parameters of the log.
array
Array of 0 to 4 32 Bytes DATA of indexed log arguments.
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x1",
"toBlock": "latest",
"address": "0xa0b86a33e6776e1e627e5c82df4c0cf77b8bb0c9"
}]
}
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "0x1",
"toBlock": "latest",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}]
}
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"removed": false,
"logIndex": "0x1",
"transactionIndex": "0x0",
"transactionHash": "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
"blockHash": "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
"blockNumber": "0x1b4",
"address": "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"topics": [
"0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"
]
}
]
}
Error Handling
| Code | Message | Description |
|---|---|---|
| -32602 | Invalid filter parameters | The filter object contains invalid parameters |
| -32005 | Limit exceeded | The filter matches too many logs |
| 4100 | Requested method not supported | The method is not supported by the wallet |
Large filter ranges may exceed provider limits. Consider using smaller block ranges for better performance.
Topics are order-dependent. Use null as a wildcard for any topic position.