eth_newFilter - Arbitrum

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

This method creates a filter that notifies the client when matching logs are generated

Parameters

  • Object

Field
Type
Description

fromBlock

string

Block height to start searching from. Accepts hex or tags.

toBlock

string

Block height to stop searching at. Accepts hex or tags.

address

string or array

Address or list of addresses to filter log events from.

topics

array

Topics used to match specific log signatures or indexed parameters.

Request

curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
   "jsonrpc": "2.0",
    "method": "eth_newFilter",
    "params": [
        {
            "fromBlock": "earliest",
            "toBlock": "latest",
            "topics": []
        }]
    "id": "getblock.io"
}'

Response

Reponse Parameter Definition

Field
Description
Data Type

result

A hexadecimal string representing the ID of the created filter.

String

Use case

The eth_newFilter method helps developers to:

  • Subscribe to smart contract events

  • Build dashboards or indexers that react to chain activity

  • Monitor ERC20 transfer logs

  • Track DeFi protocol events like swaps or deposits

  • Support NFT mint/burn/listing activity

  • Build real-time analytics with low RPC load

Error handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS_TOKEN.

-32602

Invalid argument

  • Invalid filter parameters

  • Rate limit

Integration with Web3

Using eth_newFilter allows developers to:

  • Build interfaces that listen for contract events without needing WebSocket support

  • Implement background polling workers for analytics dashboards

  • Detect state changes in dapps and update UI instantly

  • Create automated bots such as liquidation bots or claim bots

  • Watch ERC20, ERC721, and custom events in a trustless way

Last updated

Was this helpful?