eth_newFilter

Creates a filter object, based on filter options, to notify when the state changes.

Parameters

OBJECT - The filter object

Object NameRequiredTypeDetail
addressString/ArrayAddress or a list of addresses from which logs should originate.
fromBlockStringA hex code of an integer that represents the block number, "latest", "pending", or "earliest".
toBlockStringA hex code of an integer that represents the block number, "latest", "pending", or "earliest".
topicsArrayArray of 32 Bytes DATA topics. Topics are order-dependent.
"params": [{
        "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}]

📘

Specifying topic filters:

Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:

  • [] - anything
  • [A] - A in first position (and anything after)
  • [null, B] - anything in first position AND B in second position (and anything after)
  • [A, B] - A in first position AND B in second position (and anything after)
  • [[A, B], [A, B]] - (A OR B) in first position AND (A OR B) in second position (and anything after)

Result

A hex code of an integer that represents the newly created filter ID.

Example

Request

curl <your-endpoint> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":0}'

Return

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