Skip to main content

eth_newFilter

POST

Creates a filter for logs matching the specified criteria and returns a filter ID. The filter ID is used with eth_getFilterLogs and eth_uninstallFilter.

🚧 Response taking too long? Response time may increase with block range!

Specifying a wide block range or including blocks with many events can cause response delays or timeouts.

For faster responses:

- Keep the fromBlock ~ toBlock range to 1000 blocks or less.

- When using blockTag "latest", the response may be slower since the exact block number is not known internally.

In that case, use eth_blockNumber to get the latest block number and specify it explicitly.
param[0]
logObjectobjectrequired
Object for filtering logs.
fromBlockstring
Use one of block number or block tag to specify a block.
  • Block number: hex string (ex. "0x1")
  • Block tag: enum string (ex. "latest", "earliest", "pending")
Block number represents the order of blocks in the chain. It is expressed as a hexadecimal string.
toBlockstring
Use one of block number or block tag to specify a block.
  • Block number: hex string (ex. "0x1")
  • Block tag: enum string (ex. "latest", "earliest", "pending")
Block number represents the order of blocks in the chain. It is expressed as a hexadecimal string.
addressarray
Addresses to filter by, as an array.
topicsarray
Topics array for filtering transaction logs. Each topic is a 32-byte hex string.
Responses
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://avalanche-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_newFilter",
"params": [
{
"fromBlock": "0x12C1A00",
"toBlock": "0x12C1A00",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
]
}
]
}'