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
}'
{
"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"
}
]
}
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.
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
}'
{
"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"
}
]
}
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 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');
});
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
trace_block
method is essential for applications that need to:
Successful response with trace data for all transactions in the block
The response is of type object
.