eth_newBlockFilter

The eth_newBlockFilter method creates a filter in the node to notify when a new block arrives. This method returns a filter ID that can be used with eth_getFilterChanges to poll for newly mined blocks efficiently.

This method is essential for applications that need to react to new blocks in real-time, such as monitoring block production, tracking network activity, triggering actions when blocks are mined, building notification systems, and synchronizing application state with the blockchain. Unlike repeatedly calling eth_blockNumber or eth_getBlockByNumber, this filter-based approach is more efficient and reduces RPC load. Once created, use eth_getFilterChanges with the returned filter ID to retrieve new block hashes since your last poll.

Filters timeout after 5 minutes of inactivity. Regular polling with eth_getFilterChanges keeps the filter active.


Parameters

This method does not require any parameters.

Return Object
field
type
description
result
string
A filter ID as a hexadecimal string that can be used with eth_getFilterChanges to retrieve new block hashes
Request Example
Request
Response Example
Response

Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?