trace_block
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "trace_block",
"params": [
"latest"
],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "trace_block",
"params": ["latest"],
"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: 'trace_block', params: ['latest'], 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' => 'trace_block',
'params' => [
'latest'
],
'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\": \"trace_block\",\n \"params\": [\n \"latest\"\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\": \"trace_block\",\n \"params\": [\n \"latest\"\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\": \"trace_block\",\n \"params\": [\n \"latest\"\n ],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"from": "0x...",
"to": "0x...",
"value": "0x0",
"gas": "0x...",
"input": "0x...",
"callType": "call"
},
"result": {
"gasUsed": "0x5208",
"output": "0x"
},
"traceAddress": [],
"type": "call"
}
]
}Hyperliquid node API
trace_block | Hyperliquid EVM
The trace_block JSON-RPC method returns trace information for all transactions in a specific block. Hyperliquid EVM via Chainstack.
POST
/
evm
trace_block
curl --request POST \
--url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "trace_block",
"params": [
"latest"
],
"id": 1
}
'import requests
url = "https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm"
payload = {
"jsonrpc": "2.0",
"method": "trace_block",
"params": ["latest"],
"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: 'trace_block', params: ['latest'], 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' => 'trace_block',
'params' => [
'latest'
],
'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\": \"trace_block\",\n \"params\": [\n \"latest\"\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\": \"trace_block\",\n \"params\": [\n \"latest\"\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\": \"trace_block\",\n \"params\": [\n \"latest\"\n ],\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"from": "0x...",
"to": "0x...",
"value": "0x0",
"gas": "0x...",
"input": "0x...",
"callType": "call"
},
"result": {
"gasUsed": "0x5208",
"output": "0x"
},
"traceAddress": [],
"type": "call"
}
]
}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.
trace_block JSON-RPC method returns trace information for all transactions in a specific block. This method provides execution traces for all transactions within a block using OpenEthereum-style tracing, making it essential for comprehensive block analysis and monitoring.
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
- Block identifier (string, required): Block number, hash, or “latest”/“earliest”/“pending”
Response
The method returns an array of trace objects for all transactions in the specified block.Response structure
Block traces:- Array of trace objects, one for each transaction in the block
- Each trace contains execution details, gas usage, and call hierarchy
Usage example
Basic implementation
// Get traces for all transactions in a block
const traceBlock = async (blockIdentifier) => {
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: 'trace_block',
params: [blockIdentifier],
id: 1
})
});
const data = await response.json();
return data.result;
};
// Analyze block execution
const analyzeBlockExecution = async (blockIdentifier = 'latest') => {
const traces = await traceBlock(blockIdentifier);
console.log(`Block analysis for ${blockIdentifier}:`);
console.log(`Total transactions: ${traces.length}`);
let totalGasUsed = 0;
let successfulTxs = 0;
traces.forEach((trace, index) => {
const gasUsed = parseInt(trace.result.gasUsed, 16);
totalGasUsed += gasUsed;
if (trace.result.output && trace.result.output !== '0x') {
successfulTxs++;
}
console.log(` TX ${index + 1}: ${gasUsed} gas, ${trace.action.from} -> ${trace.action.to}`);
});
console.log(`Successful transactions: ${successfulTxs}/${traces.length}`);
console.log(`Total gas used: ${totalGasUsed.toLocaleString()}`);
console.log(`Average gas per transaction: ${Math.round(totalGasUsed / traces.length).toLocaleString()}`);
return traces;
};
// Usage
analyzeBlockExecution('latest').then(traces => {
console.log('Block analysis completed');
});
Example request
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_block",
"params": [
"latest"
],
"id": 1
}' \
https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("YOUR_CHAINSTACK_ENDPOINT"))
# trace_block is an OpenEthereum-style method, so call it through the raw provider
response = w3.provider.make_request("trace_block", ["latest"])
traces = response["result"]
print(f"Traces in block: {len(traces)}")
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");
// send() reaches the OpenEthereum-style trace_block method directly
const traces = await provider.send("trace_block", ["latest"]);
console.log(`Traces in block: ${traces.length}`);
import { createPublicClient, http } from "viem";
const client = createPublicClient({
transport: http("YOUR_CHAINSTACK_ENDPOINT"),
});
// trace_block is outside viem's typed schema, so use the request escape hatch
const traces = await (client.request as (args: {
method: "trace_block";
params: [string];
}) => Promise<unknown[]>)({
method: "trace_block",
params: ["latest"],
});
console.log(`Traces in block: ${traces.length}`);
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
Thetrace_block method is essential for applications that need to:
- Block monitoring: Monitor block execution and transaction patterns
- Performance analysis: Analyze block performance and gas efficiency
- Analytics platforms: Build comprehensive blockchain analytics tools
- Forensic investigation: Investigate suspicious blocks and activities
- Compliance monitoring: Monitor regulatory compliance across blocks
- Development tools: Build block-level debugging and analysis tools
- Research platforms: Support blockchain research and analysis
- MEV analysis: Analyze Maximum Extractable Value opportunities
- Security monitoring: Monitor for suspicious patterns in block execution
- Network health: Monitor network health and transaction success rates
- Gas analysis: Analyze gas usage patterns across blocks
- Protocol monitoring: Monitor protocol behavior and adoption
- Trading analysis: Analyze trading patterns and market activity
- DeFi monitoring: Monitor DeFi protocol activity and usage
- Educational tools: Create educational content about block execution
Body
application/json
Last modified on June 24, 2026
Was this page helpful?