debug_traceBlockByHash
https://api.triport.io/v1/ethReplays every transaction in a block (identified by its hash) through the EVM and returns a trace for each one.
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].
blockHashstringrequired0x-prefixed hex.optionsobjectoptionaltracerstringoptionalcallTracer or prestateTracer. Omit for the default struct/opcode logger.tracerConfigobjectoptionaltimeoutstringoptional"30s".Response
Response fields
result is an array with one entry per transaction in the block, in execution order.
| Field | Type | Description |
|---|---|---|
result[].txHash | string | Hash of the traced transaction. |
result[].result | object | The trace for that transaction. Shape depends on the selected tracer. |
For the callTracer shape, each result is a call frame:
| Field | Type | Description |
|---|---|---|
from | string | Sender address of the call. |
to | string | Recipient (or created contract) address. |
value | string | Wei transferred, 0x-hex. |
gas | string | Gas provided to the call, 0x-hex. |
gasUsed | string | Gas consumed by the call, 0x-hex. |
input | string | Call input data. |
output | string | Return data. |
type | string | Opcode of the call: CALL, STATICCALL, DELEGATECALL, CREATE, etc. |
error | string | Present only if the call reverted or failed. |
calls | array | Nested 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.
| Code | Meaning | When it happens |
|---|---|---|
-32002 | tier_insufficient | Your plan is below the pro tier required for eth_debug methods. |
-32003 | rate_limited | You 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
structLogsarray per transaction and is expensive to transfer; prefercallTracerorprestateTracerunless you specifically need opcode-level detail. - Block must exist. Trace the block by number instead with
debug_traceBlockByNumber, or trace a single transaction withdebug_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.