eth_newBlockFilter - Arbitrum
Example code for the eth_newBlockFilter JSON RPC method. Сomplete guide on how to use eth_newBlockFilter JSON RPC in GetBlock Web3 documentation.
This method returns the number of uncles in a block specified by its block number.
Parameters
None
Request
curl --location 'https://go.getblock.us/<ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": "getblock.io"
}'import axios from 'axios'
let data = JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": "getblock.io"
};
let config = {
method: "post",
maxBodyLength: Infinity,
url: "https://go.getblock.us/<ACCESS_TOKEN>",
headers: {
"Content-Type": "application/json",
},
data: data,
};
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0xd1073f126a0d0447987ff93c772d204c"
}Reponse Parameter Definition
result
A hexadecimal string representing the ID of the created filter.
String
Use case
The eth_newBlockFilter method helps developers to:
Listen for newly created blocks without constant RPC polling
Build live dashboards and monitoring systems
Support lightweight clients and browser-based dApps
Track chain activity for indexers, explorers, or analytics tools
Implement auto-refresh on UIs when new blocks are published
Error handling
403
Forbidden
Missing or invalid ACCESS_TOKEN.
-32602
Invalid argument
Invalid block number
Integration with Web3
Last updated
Was this helpful?