debug_traceBlockByHash RPC Method
Re-executes every transaction in a block (looked up by hash) and returns the trace output.
Parameters#
stringrequired
32-byte block hash, hex-encoded.
objectrequired
Object that controls tracing behavior:
tracerstring
Tracer type to apply: callTracer or prestateTracer.
tracerConfigobjectoptional
Optional settings for the chosen tracer:
onlyTopCallbooleanoptional
If true, limits tracing to the outermost call frame only.
diffModebooleanoptional
If true, outputs state differences instead of full pre-state (prestateTracer only).
withLogbooleanoptional
If true, attaches event logs to the trace output.
Result#
array - Collection of per-transaction trace result objects.
Code sample#
{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
{
"tracer": "callTracer"
}
],
"id": 1
}
Response#
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txHash": "0x0e07d8b53ed3d91314c80e53cf25bcde02084939395845cbb625b029d568135c",
"result": {
"type": "CALL",
"from": "0x3cf412d970474804623bb4e3a42de13f9bca5436",
"to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"value": "0x0",
"gas": "0x46a02",
"gasUsed": "0x5208",
"input": "0x5ae401dc...",
"output": "0x"
}
}
]
}
Try It