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": [
  {
    "fromBlock": "0xDC7F79",
    "toBlock": "0xDC7F7B",
    "address": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
    "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":[{"fromBlock": "0xDC7F79","toBlock": "0xDC7F7B","address": "0xea674fdde714fd979de3edf0f56aa9716b898ec8","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}],"id":0}'

Return

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