eth_newBlockFilter
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', method: 'eth_newBlockFilter', params: [], id: 1})
};
fetch('https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'method' => 'eth_newBlockFilter',
'params' => [
],
'id' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}Hyperliquid node API
eth_newBlockFilter | Hyperliquid EVM
The eth_newBlockFilter JSON-RPC method creates a filter object to notify when new blocks arrive on the blockchain. On Hyperliquid EVM.
POST
/
evm
eth_newBlockFilter
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', method: 'eth_newBlockFilter', params: [], id: 1})
};
fetch('https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'method' => 'eth_newBlockFilter',
'params' => [
],
'id' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_newBlockFilter\",\n \"params\": [],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1"
}This method is available on Chainstack. Not all Hyperliquid methods are available on Chainstack, as the open-source node implementation does not support them yet — see Hyperliquid methods for the full availability breakdown.
eth_newBlockFilter JSON-RPC method creates a filter object to notify when new blocks arrive on the blockchain. This method returns a filter ID that can be used with eth_getFilterChanges to retrieve new block hashes as they are mined, providing an efficient way to monitor blockchain progression.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
This method takes no parameters. Theparams field should be an empty array.
Response
The method returns a filter ID as a hexadecimal string that can be used to retrieve new block hashes.Response structure
Filter ID:- Returns a unique filter identifier as a hexadecimal string
- Use this ID with
eth_getFilterChangesto get new block hashes - Each call to
eth_getFilterChangesreturns only new blocks since the last call - Filters have a limited lifetime and may expire if not used
Block filter behavior
Monitoring:- The filter starts monitoring from the time it’s created
- Only new blocks mined after filter creation are returned
- Block hashes are returned in chronological order
- The filter automatically tracks the last retrieved block
Usage example
Basic implementation
// Create a new block filter
const createBlockFilter = async () => {
const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_newBlockFilter',
params: [],
id: 1
})
});
const data = await response.json();
return data.result;
};
// Get new blocks from filter
const getFilterChanges = async (filterId) => {
const response = await fetch('https://hyperliquid-mainnet.core.chainstack.com/YOUR_ENDPOINT/evm', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getFilterChanges',
params: [filterId],
id: 1
})
});
const data = await response.json();
return data.result;
};
// Monitor new blocks with callback
const monitorNewBlocks = async (callback) => {
const filterId = await createBlockFilter();
console.log(`Created block filter: ${filterId}`);
const pollForNewBlocks = async () => {
try {
const newBlocks = await getFilterChanges(filterId);
if (newBlocks && newBlocks.length > 0) {
for (const blockHash of newBlocks) {
callback(blockHash);
}
}
} catch (error) {
console.error('Error polling for new blocks:', error);
}
};
// Poll every 2 seconds
const intervalId = setInterval(pollForNewBlocks, 2000);
return {
filterId,
stop: () => clearInterval(intervalId)
};
};
// Block statistics tracker
const trackBlockStatistics = async () => {
const stats = {
blocksReceived: 0,
startTime: Date.now(),
blockHashes: [],
averageBlockTime: 0
};
const monitor = await monitorNewBlocks((blockHash) => {
stats.blocksReceived++;
stats.blockHashes.push({
hash: blockHash,
timestamp: Date.now()
});
// Calculate average block time
if (stats.blockHashes.length > 1) {
const timeSpan = stats.blockHashes[stats.blockHashes.length - 1].timestamp -
stats.blockHashes[0].timestamp;
stats.averageBlockTime = timeSpan / (stats.blockHashes.length - 1);
}
console.log(`New block: ${blockHash}`);
console.log(`Total blocks: ${stats.blocksReceived}, Avg time: ${stats.averageBlockTime.toFixed(0)}ms`);
});
return {
stats,
monitor
};
};
// Block notification system
const createBlockNotifier = async (webhookUrl) => {
const monitor = await monitorNewBlocks(async (blockHash) => {
try {
await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'new_block',
blockHash,
timestamp: new Date().toISOString()
})
});
} catch (error) {
console.error('Failed to send block notification:', error);
}
});
return monitor;
};
// Usage examples
monitorNewBlocks((blockHash) => {
console.log(`New block mined: ${blockHash}`);
}).then(monitor => {
console.log('Block monitoring started');
// Stop monitoring after 5 minutes
setTimeout(() => {
monitor.stop();
console.log('Block monitoring stopped');
}, 5 * 60 * 1000);
});
// Track block statistics
trackBlockStatistics().then(({ stats, monitor }) => {
console.log('Block statistics tracking started');
// Display stats every 30 seconds
setInterval(() => {
console.log('Block Stats:', stats);
}, 30000);
});
Example request
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newBlockFilter",
"params": [],
"id": 1
}' \
https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("YOUR_CHAINSTACK_ENDPOINT"))
# Create a filter that notifies on every new block.
block_filter = w3.eth.filter("latest")
print(block_filter.filter_id)
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");
// eth_newBlockFilter has no high-level wrapper, so send the raw call.
const filterId = await provider.send("eth_newBlockFilter", []);
console.log(filterId);
import { createPublicClient, http } from "viem";
const client = createPublicClient({
transport: http("YOUR_CHAINSTACK_ENDPOINT"),
});
// createBlockFilter maps to eth_newBlockFilter.
const filter = await client.createBlockFilter();
console.log(filter.id);
Use your own endpoint in your code. The code examples use a placeholder Chainstack endpoint (YOUR_CHAINSTACK_ENDPOINT) — replace it with your own Hyperliquid node endpoint from the Chainstack console. The curl above uses a shared public endpoint for quick checks only; do not use it in production.
Use cases
Theeth_newBlockFilter method is essential for applications that need to:
- Real-time monitoring: Monitor blockchain progression in real-time
- Block notifications: Create notification systems for new blocks
- Chain synchronization: Implement efficient chain synchronization mechanisms
- Mining analytics: Track block mining rates and patterns
- Network health monitoring: Monitor network performance and block times
- DeFi applications: React to new blocks for time-sensitive operations
- Block explorers: Update block explorer data as new blocks arrive
- Transaction monitoring: Detect new blocks to check for transaction confirmations
- Performance analytics: Analyze blockchain performance metrics
- Automated trading: Trigger trading logic based on new block arrivals
- Consensus monitoring: Monitor blockchain consensus and chain progression
- Alert systems: Create alerts based on block timing and frequency
- Data synchronization: Synchronize application data with blockchain state
- Event triggering: Trigger application events when new blocks are mined
- Statistics collection: Collect blockchain statistics and metrics
Body
application/json
Last modified on June 24, 2026
Was this page helpful?