eth_newBlockFilter
JSON-RPC method creates a filter object to notify when new blocks arrive on the blockchain. This method returns a filter ID that can be used with eth_getFilterChanges
to retrieve new block hashes as they are mined, providing an efficient way to monitor blockchain progression.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
This method takes no parameters. Theparams
field should be an empty array.
Response
The method returns a filter ID as a hexadecimal string that can be used to retrieve new block hashes.Response structure
Filter ID:- Returns a unique filter identifier as a hexadecimal string
- Use this ID with
eth_getFilterChanges
to get new block hashes - Each call to
eth_getFilterChanges
returns only new blocks since the last call - Filters have a limited lifetime and may expire if not used
Block filter behavior
Monitoring:- The filter starts monitoring from the time it’s created
- Only new blocks mined after filter creation are returned
- Block hashes are returned in chronological order
- The filter automatically tracks the last retrieved block
Usage example
Basic implementation
Example request
Shell
Use cases
Theeth_newBlockFilter
method is essential for applications that need to:
- Real-time monitoring: Monitor blockchain progression in real-time
- Block notifications: Create notification systems for new blocks
- Chain synchronization: Implement efficient chain synchronization mechanisms
- Mining analytics: Track block mining rates and patterns
- Network health monitoring: Monitor network performance and block times
- DeFi applications: React to new blocks for time-sensitive operations
- Block explorers: Update block explorer data as new blocks arrive
- Transaction monitoring: Detect new blocks to check for transaction confirmations
- Performance analytics: Analyze blockchain performance metrics
- Automated trading: Trigger trading logic based on new block arrivals
- Consensus monitoring: Monitor blockchain consensus and chain progression
- Alert systems: Create alerts based on block timing and frequency
- Data synchronization: Synchronize application data with blockchain state
- Event triggering: Trigger application events when new blocks are mined
- Statistics collection: Collect blockchain statistics and metrics
Body
application/json