TriportRPC

debug_traceBlockByHash

POSThttps://api.triport.io/v1/eth

Replays every transaction in a block (identified by its hash) through the EVM and returns a trace for each one.

Ethereumeth_debugpro (5 RPS) · business (15 RPS)

debug_traceBlockByHash re-executes all transactions contained in the block with the given hash and returns an EVM trace for each transaction, in block order. It is the hash-addressed counterpart to debug_traceBlockByNumber and produces the same per-transaction trace shape as debug_traceTransaction.

Use it when you need to reconstruct exactly what happened inside a block — internal calls, value transfers, reverts, and state changes — without tracing each transaction individually. Common uses are indexing internal transactions, reconciling token transfers, and post-mortem analysis of a failed or exploited block.

Tracing replays the full block against an archived state, so it is significantly more expensive than a normal read. It is gated to the pro and business tiers and rate limited more tightly than eth_* reads. Choose a tracer with the tracer option to control the output: omit it for the raw opcode-level struct log, or pass a built-in tracer such as callTracer (call tree) or prestateTracer (touched state) for a compact, structured result.

Parameters

Positional params array: [blockHash, options].

blockHashstringrequired
32-byte block hash, 0x-prefixed hex.
optionsobjectoptional
Tracer selection and configuration. Omit for the default struct (opcode) logger.
tracerstringoptional
Built-in tracer name: callTracer or prestateTracer. Omit for the default struct/opcode logger.
tracerConfigobjectoptional
Tracer-specific configuration (see below).
timeoutstringoptional
Per-block trace timeout as a Go duration string, e.g. "30s".

Response

Response fields

result is an array with one entry per transaction in the block, in execution order.

FieldTypeDescription
result[].txHashstringHash of the traced transaction.
result[].resultobjectThe trace for that transaction. Shape depends on the selected tracer.

For the callTracer shape, each result is a call frame:

FieldTypeDescription
fromstringSender address of the call.
tostringRecipient (or created contract) address.
valuestringWei transferred, 0x-hex.
gasstringGas provided to the call, 0x-hex.
gasUsedstringGas consumed by the call, 0x-hex.
inputstringCall input data.
outputstringReturn data.
typestringOpcode of the call: CALL, STATICCALL, DELEGATECALL, CREATE, etc.
errorstringPresent only if the call reverted or failed.
callsarrayNested child call frames (same shape). Omitted when there are none or onlyTopCall is set.

With no tracer, each result is the default struct logger output (gas, failed, returnValue, structLogs[]). With prestateTracer, each result maps touched account addresses to their state.

Errors

Errors use the shared JSON-RPC error envelope — see errors.md for the full structure.

CodeMeaningWhen it happens
-32002tier_insufficientYour plan is below the pro tier required for eth_debug methods.
-32003rate_limitedYou exceeded your tier's RPS for this method (5 RPS on pro, 15 RPS on business).

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/eth", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "debug_traceBlockByHash",
    params: [
      "0xf3f3f3a1c2d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e",
      { tracer: "callTracer", tracerConfig: { onlyTopCall: false } },
    ],
  }),
});


const { result } = await res.json();
console.log(`traced ${result.length} transactions`);

TypeScript SDK (@triport/sdk)

import { Triport } from "@triport/sdk";


const triport = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });


const traces = await triport.eth.debugTraceBlockByHash(
  "0xf3f3f3a1c2d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e",
  { tracer: "callTracer" },
);


for (const tx of traces) {
  console.log(tx.txHash, tx.result.gasUsed);
}

Python (triport-sdk)

import os
from triport import Triport


client = Triport(api_key=os.environ["TRIPORT_API_KEY"])


traces = client.eth.debug_trace_block_by_hash(
    "0xf3f3f3a1c2d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e",
    options={"tracer": "callTracer"},
)


for tx in traces:
    print(tx["txHash"], tx["result"]["gasUsed"])

Notes

  • Pick a tracer. The default struct (opcode) logger produces a large structLogs array per transaction and is expensive to transfer; prefer callTracer or prestateTracer unless you specifically need opcode-level detail.
  • Block must exist. Trace the block by number instead with debug_traceBlockByNumber, or trace a single transaction with debug_traceTransaction.
  • Tracing replays against archived state; very old or pruned state may not be available on all tiers.
  • Rate limits are RPS-per-tier with burst — there is no daily quota.