Ethereum

Ethereum

eth_newBlockFilter

eth_newBlockFilter registers a server-side filter that watches for new blocks on Ethereum and hands you back a hex filter ID. There are no parameters: the filter simply accumulates the hash of every block the node sees, and you drain that buffer by polling eth_getFilterChanges with the ID. Each poll returns the block hashes that arrived since your last call, so on mainnet you can expect roughly one new hash per 12-second slot under PoS. Create the filter against https://ethereum.therpc.io/YOUR_API_KEY on chain ID 1. This is the lightest of the filter family, since it tracks block arrivals rather than logs or mempool entries, and it pairs with eth_uninstallFilter for cleanup.

Use cases

  • Drive a per-block work loop: on each new hash, re-check the status of transactions you broadcast, since a fresh Ethereum block is the only moment new inclusions can happen.
  • Bust caches on every new block hash, so price reads, balances, and contract state you memoized never lag more than one 12-second slot behind the chain head.

Parameters

This method takes no parameters. Pass an empty array [].

Response

TypeDescription
stringHex filter ID. When polled with eth_getFilterChanges, yields an array of new block hashes since the last poll.

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32000filter not foundProvider rejected filter creation or the filter limit was reached.

Common pitfalls

  • The filter yields bare block hashes, nothing more. To get a block's transactions or header you still call eth_getBlockByHash with each hash.
  • Nodes time out idle filters after a few minutes. If eth_getFilterChanges comes back with a filter-not-found error, recreate the filter and resume.
  • A hash at the chain head can still be reorged before justification. For anything that moves ETH, wait for the safe or finalized tag (about 12.8 minutes for full finality) before treating a block as settled.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_newBlockFilter","params":[]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.