eth_getBlockTransactionCountByNumber
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"0x9d0c37"
],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x9d0c37"],
"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_getBlockTransactionCountByNumber',
params: ['0x9d0c37'],
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_getBlockTransactionCountByNumber',
'params' => [
'0x9d0c37'
],
'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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3"
}Hyperliquid node API
eth_getBlockTransactionCountByNumber | Hyperliquid EVM
The eth_getBlockTransactionCountByNumber JSON-RPC method returns the number of transactions in a block by its number. On Hyperliquid EVM.
POST
/
evm
eth_getBlockTransactionCountByNumber
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": [
"0x9d0c37"
],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x9d0c37"],
"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_getBlockTransactionCountByNumber',
params: ['0x9d0c37'],
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_getBlockTransactionCountByNumber',
'params' => [
'0x9d0c37'
],
'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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\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_getBlockTransactionCountByNumber\",\n \"params\": [\n \"0x9d0c37\"\n ],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3"
}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_getBlockTransactionCountByNumber JSON-RPC method returns the number of transactions in a block by its number. This method provides a lightweight way to get transaction count information for sequential block analysis, making it efficient for building statistics and monitoring network activity over time.
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
The method takes one parameter:- Block number - The number of the block to get the transaction count for
Parameter details
blockNumber(string, required) — Block identifier:"latest","earliest","pending", or a specific block number in hexadecimal
Response
The method returns the number of transactions in the specified block as a hexadecimal string, ornull if the block is not found.
Response structure
Transaction count:result— The number of transactions in the block as a hexadecimal string
Data interpretation
Count format:- Returned as hexadecimal string with
0xprefix - Convert to decimal for numerical operations
0x0indicates an empty block (no transactions)nullindicates the block number doesn’t exist
"latest"— Most recent block transaction count"earliest"— Genesis block transaction count (usually 0)"pending"— Pending block transaction count"0x9d0c37"— Specific block number (10,291,255 in decimal)
Usage example
Basic implementation
// Get transaction count for a block by number on Hyperliquid
const getBlockTransactionCountByNumber = async (blockNumber) => {
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_getBlockTransactionCountByNumber',
params: [blockNumber],
id: 1
})
});
const data = await response.json();
if (data.result === null) {
throw new Error('Block not found');
}
return {
hex: data.result,
decimal: parseInt(data.result, 16)
};
};
// Analyze a range of blocks for activity patterns
const analyzeBlockRange = async (startBlock, endBlock) => {
const results = [];
for (let i = startBlock; i <= endBlock; i++) {
const hexBlock = "0x" + i.toString(16);
try {
const count = await getBlockTransactionCountByNumber(hexBlock);
results.push({
blockNumber: i,
hexBlockNumber: hexBlock,
transactionCount: count.decimal
});
} catch (error) {
console.error(`Error processing block ${i}:`, error);
results.push({
blockNumber: i,
hexBlockNumber: hexBlock,
transactionCount: null,
error: error.message
});
}
}
// Calculate statistics
const validCounts = results
.filter(r => r.transactionCount !== null)
.map(r => r.transactionCount);
if (validCounts.length === 0) {
return { results, statistics: null };
}
const statistics = {
totalBlocks: validCounts.length,
totalTransactions: validCounts.reduce((sum, count) => sum + count, 0),
averageTransactions: validCounts.reduce((sum, count) => sum + count, 0) / validCounts.length,
maxTransactions: Math.max(...validCounts),
minTransactions: Math.min(...validCounts),
emptyBlocks: validCounts.filter(count => count === 0).length
};
return { results, statistics };
};
// Get latest block transaction count
const getLatestBlockTransactionCount = async () => {
return await getBlockTransactionCountByNumber('latest');
};
// Usage examples
getLatestBlockTransactionCount()
.then(count => console.log(`Latest block has ${count.decimal} transactions`))
.catch(error => console.error('Error:', error));
// Analyze blocks 100-110
analyzeBlockRange(100, 110)
.then(analysis => {
console.log('Block Range Analysis:', analysis.statistics);
console.log('Detailed Results:', analysis.results);
})
.catch(error => console.error('Error:', error));
Sequential analysis benefits
Range processing
Efficient bulk analysis:- Query transaction counts across block ranges efficiently
- Build activity timelines and trend analysis
- Generate network utilization statistics
- Identify periods of high and low activity
Block number formats
Special identifiers:"latest"— Most recent block transaction count"earliest"— Genesis block transaction count (usually 0)"0x9d0c37"— Specific block number (10,291,255 in decimal)
Example request
curl -X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x9d0c37"],"id":1}' \
https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("YOUR_CHAINSTACK_ENDPOINT"))
# Block 0x9d0c37 (10,291,255). Pass an int for by-number, or "latest" for the tip.
count = w3.eth.get_block_transaction_count(10291255)
print(count)
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");
// ethers v6 has no high-level wrapper for this RPC, so call it directly.
const count = await provider.send("eth_getBlockTransactionCountByNumber", ["0x9d0c37"]);
console.log(parseInt(count, 16));
import { createPublicClient, http } from "viem";
const client = createPublicClient({
transport: http("YOUR_CHAINSTACK_ENDPOINT"),
});
// blockNumber is a bigint; omit it (or use blockTag: "latest") for the tip.
const count = await client.getBlockTransactionCount({ blockNumber: 10291255n });
console.log(count);
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_getBlockTransactionCountByNumber method is essential for applications that need to:
- Sequential analysis: Analyze transaction counts across block ranges efficiently
- Network monitoring: Track blockchain activity and usage patterns over time
- Statistics generation: Build comprehensive network activity statistics
- Block explorers: Display transaction counts in sequential block listings
- Analytics platforms: Collect activity data for network analysis and trends
- Real-time monitoring: Track current network activity using “latest” block
- Development tools: Optimize applications based on network activity levels
- Data visualization: Create time-series charts of block activity patterns
This method supports special block identifiers like
"latest" and "earliest", making it suitable for both historical analysis and real-time monitoring. The count includes both regular transactions and system transactions from HyperCore.Body
application/json
JSON-RPC version
Available options:
2.0 The RPC method name
Available options:
eth_getBlockTransactionCountByNumber Parameters: [blockNumber]
Request identifier
Last modified on June 24, 2026
Was this page helpful?