curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}eth_getFilterChanges to get new block hashes.
With Tempo’s ~0.5 second block times, this filter will receive frequent updates.
noneresult — the filter IDeth_newBlockFilter code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const createBlockFilter = async () => {
const filterId = await provider.send("eth_newBlockFilter", []);
console.log(`Filter ID: ${filterId}`);
// Poll for new blocks
const newBlocks = await provider.send("eth_getFilterChanges", [filterId]);
console.log(`New block hashes: ${newBlocks}`);
};
createBlockFilter();
Was this page helpful?