eth_getBlockTransactionCountByHash
curl --request POST \
--url https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd"
]
}
'import requests
url = "https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd"]
}
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({
id: 1,
jsonrpc: '2.0',
method: 'eth_getBlockTransactionCountByHash',
params: ['0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd']
})
};
fetch('https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f', 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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f",
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([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'eth_getBlockTransactionCountByHash',
'params' => [
'0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd'
]
]),
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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f")
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 \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}Fantom node API
eth_getBlockTransactionCountByHash | Fantom
Fantom API method that returns the number of transactions in a block specified by block hash. This information can be useful for analytics purposes.
POST
/
4ab982aa70a7baead515ffdb5915df3f
eth_getBlockTransactionCountByHash
curl --request POST \
--url https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": [
"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd"
]
}
'import requests
url = "https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd"]
}
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({
id: 1,
jsonrpc: '2.0',
method: 'eth_getBlockTransactionCountByHash',
params: ['0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd']
})
};
fetch('https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f', 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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f",
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([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'eth_getBlockTransactionCountByHash',
'params' => [
'0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd'
]
]),
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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\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://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fantom-mainnet.core.chainstack.com/4ab982aa70a7baead515ffdb5915df3f")
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 \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBlockTransactionCountByHash\",\n \"params\": [\n \"0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}Fantom API method that returns the number of transactions in a block specified by block hash. This information can be useful for analytics purposes.
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
hash— the block hash of the requested block.
Response
quantity— an integer value representing how many transactions are included in the block.
eth_getBlockTransactionCountByHash code examples
const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const getTransactionsCount = async (blockHash) => {
const count = await provider.send("eth_getBlockTransactionCountByHash", [blockHash]);
console.log(count);
};
getTransactionsCount('0x0004358a000018587faea5158124f479fb25360d25029e662d336e3a3508ffb3');
from web3 import Web3
node_url = "CHAINSTACK_NODE_URL"
web3 = Web3(Web3.HTTPProvider(node_url))
print(web3.eth.get_block_transaction_count("0x0004358a000018587faea5158124f479fb25360d25029e662d336e3a3508ffb3"))
Use case
eth_getBlockTransactionCountByHash is a useful tool for analyzing transaction volume on the Fantom blockchain. On average, a new block is generated on the Fantom mainnet every 3 seconds, resulting in approximately 1,200 blocks per hour. Using a Web3 library, one can inspect the past 1,200 blocks starting from the latest block, retrieve the hash of each block, and use eth_getBlockTransactionCountByHash to find the number of transactions in each block.Last modified on June 25, 2026
Was this page helpful?