eth_newBlockFilter
Creates a filter in the node, to notify when a new block arrives on Avalanche C-Chain.
Parameters
This method accepts no parameters.
{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 73
}
Returns
QUANTITY
- A filter id.
Implementation Example
- cURL
- JavaScript
curl -X POST https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 73
}'
const response = await fetch('https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_newBlockFilter',
params: [],
id: 73
})
});
const data = await response.json();
console.log(data.result);
Response Example
{
"id": 73,
"jsonrpc": "2.0",
"result": "0x1"
}
Note: Use the returned filter ID with eth_getFilterChanges to poll for new blocks on Avalanche's fast network.
Need help? Contact our support team or check the Avalanche documentation.