debug_traceBlock
debug的traceBlock
方法返回包含在指定区块中的所有交易中的所有
被调用操作码的栈跟踪记录。注意,必须存在该区块的父区块,否则该方法
调用将失败。
调用方法
Go:
debug.TraceBlock(blockRlp []byte, config. *vm.Config) BlockTraceResult
Geth控制台:
debug.traceBlock(tblockRlp, [options])
JSON RPC:
{"method": "debug_traceBlock", "params": [blockRlp, {}]}
示例代码
下面的示例在Geth控制台使用traceBlock方法:
> debug.traceBlock("0xblock_rlp")
{
gas: 85301,
returnValue: "",
structLogs: [{
depth: 1,
error: "",
gas: 162106,
gasCost: 3,
memory: null,
op: "PUSH1",
pc: 0,
stack: [],
storage: {}
},
/* snip */
{
depth: 1,
error: "",
gas: 100000,
gasCost: 0,
memory: ["0000000000000000000000000000000000000000000000000000000000000006", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000060"],
op: "STOP",
pc: 120,
stack: ["00000000000000000000000000000000000000000000000000000000d67cbec9"],
storage: {
0000000000000000000000000000000000000000000000000000000000000004: "8241fa522772837f0d05511f20caa6da1d5a3209000000000000000400000001",
0000000000000000000000000000000000000000000000000000000000000006: "0000000000000000000000000000000000000000000000000000000000000001",
f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f: "00000000000000000000000002e816afc1b5c0f39852131959d946eb3b07b5ad"
}
}]
参考资料
以太坊RLP编码算法:RLP