curl --request POST \
--url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}eth_getFilterChanges to poll for new blocks.
noneresult — the filter ID, used to poll for new blocks with eth_getFilterChanges.eth_newBlockFilter code examplesconst { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");
async function createBlockFilter() {
const filterId = await provider.send("eth_newBlockFilter", []);
console.log("Filter ID:", filterId);
// Poll for new blocks
setInterval(async () => {
const changes = await provider.send("eth_getFilterChanges", [filterId]);
if (changes.length > 0) {
console.log("New blocks:", changes);
}
}, 2000);
}
createBlockFilter();
eth_newBlockFilter is building applications that need to react to new blocks as they are mined, such as block explorers, monitoring tools, or HTTP-only clients that can’t hold a persistent WebSocket connection. For real-time streaming, prefer eth_subscribe("newHeads") over WebSocket — see the event-monitoring tutorial.Was this page helpful?