> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# debug_traceBlockByHash | Tempo

> Tempo API method that returns detailed traces for all transactions in a block specified by block hash. Chainstack Tempo reference.

Tempo API method that returns detailed traces for all transactions in a block specified by block hash. This is useful for analyzing all contract interactions within a specific block.

## Parameters

* `blockHash` — the hash of the block to trace
* `tracerConfig` — (optional) tracer configuration object:
  * `tracer` — tracer type (e.g., `callTracer`, `prestateTracer`)
  * `timeout` — (optional) timeout for the trace
  * `tracerConfig` — (optional) tracer-specific configuration

## Response

* `result` — array of trace objects, one for each transaction in the block. The format depends on the tracer used.

For `callTracer`, each trace contains:

* `from` — sender address
* `to` — recipient address
* `gas` — gas provided
* `gasUsed` — gas consumed
* `input` — call data
* `output` — return data
* `calls` — nested array of internal calls
* `type` — call type (CALL, DELEGATECALL, etc.)

## `debug_traceBlockByHash` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const traceBlockByHash = async (blockHash) => {
      const traces = await provider.send("debug_traceBlockByHash", [
        blockHash,
        { tracer: "callTracer" }
      ]);

      console.log(`Block contains ${traces.length} transaction traces`);
      for (let i = 0; i < traces.length; i++) {
        const trace = traces[i].result;
        console.log(`\nTx ${i}: ${trace.from} -> ${trace.to}`);
        console.log(`  Type: ${trace.type}, Gas Used: ${trace.gasUsed}`);
      }
    };

  traceBlockByHash("0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e");
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  result = web3.provider.make_request("debug_traceBlockByHash", [
      "0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e",
      {"tracer": "callTracer"}
  ])

  traces = result['result']
  print(f"Block contains {len(traces)} transaction traces")

  for i, tx_trace in enumerate(traces):
      trace = tx_trace['result']
      print(f"\nTx {i}: {trace['from']} -> {trace.get('to', 'Contract Creation')}")
      print(f"  Type: {trace['type']}, Gas Used: {trace['gasUsed']}")
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "debug_traceBlockByHash",
      "params": ["0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e", {"tracer": "callTracer"}],
      "id": 1
    }'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/tempo_node_api/debug_and_trace/debug_traceBlockByHash.json POST /
openapi: 3.0.0
info:
  title: debug_traceBlockByHash Tempo example
  version: 1.0.0
  description: This is an API example for debug_traceBlockByHash for Tempo.
servers:
  - url: https://tempo-mainnet.core.chainstack.com/c3ce2925b51f1ed18719fe8a23bbdccf
security: []
paths:
  /:
    post:
      tags:
        - Debug and trace
      summary: debug_traceBlockByHash
      operationId: tempo-debug-traceBlockByHash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: debug_traceBlockByHash
                params:
                  type: array
                  items: {}
                  default:
                    - >-
                      0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e
                    - tracer: callTracer
                  description: Block hash and optional tracer config
                id:
                  type: integer
                  default: 1
      responses:
        '200':
          description: Array of transaction traces
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: array
                    items:
                      type: object
                    description: Array of trace objects for each transaction

````