API Reference

eth_newFilter

'Creates a filter object based on filter options to enable notifications (logs) for state changes.'
'You can use the eth_getFilterChanges method to check whether the state of the filter has changed.'

🚧

Limits:

  • The filter expires if it remains inactive (no queries) for 5 minutes.
  • To ensure the efficiency of filter execution, it is recommended to query a range of no more than 5,000 blocks.

Request Parameters

  • Filter object
    • address - [Optional] The contract address or the list of log addresses.
    • fromBlock - [Optional. Default value: "latest"] - A hexadecimal block number, or the string "latest", "earliest", or "pending".
    • toBlock - [Optional. Default value: "latest"] - A hexadecimal block number, or the string "latest", "earliest", or "pending".
    • topics - [Optional] - An array of 32-byte. Topics are order-dependent.

A note on topic filters: Topics are strongly order-dependent. A transaction with topics of [A, B] can be matched by the following topic filters:

  • []: any topic
  • [A]: A in the first position (and any position after)
  • [null, B]: anything in the first position and B in the second position (and any position after)
  • [A, B]: A in the first position and B in the second position (and any position after)
  • [[A, B], [A, B]]: (A or B) in the first position and (A or B) in the second position (and any position after)

Response

The unique ID of the filter.

Result Fields

  • FILTER ID: a hexadecimal string, which indicates the ID of the newly created filter.

Examples

Example Responses
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x1e081"
}
Language
Click Try It! to start a request and see the response here!