eth_getLogs RPC Method

Queries event logs that match the provided filter criteria.

Parameters#

objectrequired

Filter object containing the following fields:

fromBlockstringoptional

Starting block number (hex-encoded) or block tag for the query range.

toBlockstringoptional

Ending block number (hex-encoded) or block tag for the query range.

addressstring | arrayoptional

A single contract address or an array of addresses to scope the log search.

topicsarrayoptional

Ordered array of 32-byte topic hashes used to narrow down matching events.

Result#

array - A list of log objects that satisfy the filter criteria.

Code sample#

{
  "jsonrpc": "2.0",
  "method": "eth_getLogs",
  "params": [
    {
      "fromBlock": "0x0",
      "toBlock": "0x1",
      "address": "0xac4b3dacb91461209ae9d41ec517c2b9cb1b7daf",
      "topics": []
    }
  ],
  "id": 1
}

Response#

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": []
}
Try It