eth_newFilter - ARC

Example code for the eth_newFilter JSON-RPC method. Complete guide on how to use eth_newFilter JSON-RPC in GetBlock Web3 documentation.

This method creates a new log filter on the node. The returned filter ID is then polled with eth_getFilterChanges to retrieve matching logs as they appear. Filters are server-side and expire if not polled.

Parameters

Parameter
Type
Required
Description

filterObject

object

Yes

Filter with optional fromBlock, toBlock, address, topics

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_newFilter",
    "params": [
        {
            "fromBlock": "latest",
            "address": "0x4cef52a8f9d4b0c8b8d5f1a2b3c4d5e6f7a8b9c0",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
            ]
        }
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

string

Filter ID, used as input to eth_getFilterChanges and eth_uninstallFilter

Use Cases

  • Server-side polling of new payment events

  • Building event subscribers in environments without WebSocket support

  • Lightweight alternative to WebSocket eth_subscribe

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

-32601

Method not found

The method is not supported by this node

429

Too Many Requests

Rate limit exceeded for your plan

SDK Integration

Last updated

Was this helpful?