POST
/
evm
trace_replayBlockTransactions
curl --request POST \
  --url https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "trace_replayBlockTransactions",
  "params": [
    "latest",
    [
      "trace"
    ]
  ],
  "id": 1
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "trace": [
        {
          "action": {
            "from": "0x...",
            "to": "0x...",
            "value": "0x0",
            "gas": "0x...",
            "input": "0x...",
            "callType": "call"
          },
          "result": {
            "gasUsed": "0x5208",
            "output": "0x"
          },
          "traceAddress": [],
          "type": "call"
        }
      ]
    }
  ]
}
The trace_replayBlockTransactions JSON-RPC method replays all transactions in a block and returns trace information for each transaction. This method provides detailed execution traces for all transactions in a specific block by replaying their execution, making it essential for comprehensive block analysis.
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

  1. Block identifier (string, required): Block number, hash, or “latest”/“earliest”/“pending”
  2. Trace types (array, required): Array of trace types to include in response

Trace types

  • "trace": Basic execution trace information
  • "vmTrace": Virtual machine execution trace
  • "stateDiff": State differences caused by transactions

Response

The method returns an array of trace results for each transaction in the block.

Response structure

Block trace results:
  • Array of trace results, one per transaction in the block
  • Each result contains detailed execution traces for the transaction

Usage example

Basic implementation

// Replay all transactions in a block with tracing
const replayBlockTransactions = async (blockIdentifier, traceTypes = ['trace']) => {
  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_replayBlockTransactions',
      params: [blockIdentifier, traceTypes],
      id: 1
    })
  });
  
  const data = await response.json();
  return data.result;
};

// Example usage
replayBlockTransactions('latest').then(results => {
  console.log(`Replayed ${results.length} transactions`);
  results.forEach((result, index) => {
    console.log(`Transaction ${index + 1}:`);
    if (result.trace) {
      result.trace.forEach(trace => {
        console.log(`  Gas used: ${parseInt(trace.result.gasUsed, 16)}`);
      });
    }
  });
});

Example request

Shell
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "trace_replayBlockTransactions",
    "params": [
      "latest",
      ["trace"]
    ],
    "id": 1
  }' \
  https://hyperliquid-mainnet.core.chainstack.com/4f8d8f4040bdacd1577bff8058438274/evm

Use cases

The trace_replayBlockTransactions method is essential for applications that need to:
  • Block analysis: Analyze complete blocks with detailed execution traces
  • Performance monitoring: Monitor transaction execution performance across blocks
  • Analytics platforms: Build comprehensive blockchain analytics tools
  • Forensic investigation: Investigate suspicious blocks with complete trace data
  • Compliance monitoring: Monitor regulatory compliance across entire blocks
  • Development tools: Build block-level debugging and analysis tools
  • Research platforms: Support detailed blockchain research and analysis
  • Security auditing: Audit block execution for security issues
  • MEV analysis: Analyze Maximum Extractable Value opportunities across blocks
  • Protocol monitoring: Monitor protocol behavior across multiple transactions
This method provides comprehensive block-level transaction replay capabilities with detailed traces on the Hyperliquid EVM platform.

Body

application/json

Response

200 - application/json

Successful response with trace data for all transactions

The response is of type object.