trace_transaction
方法检索由其哈希标识的交易的详细追踪信息。此方法提供了对交易执行的每一步的洞察,包括合约之间的内部调用,允许进行深入分析和调试。
此方法返回交易执行期间所有操作的追踪数组。
要追踪的交易的哈希
交易中所有操作的追踪对象数组
关于调用操作的详情
调用类型(call, delegatecall 等)
发送者地址
为调用提供的燃料(十六进制)
调用的输入数据(十六进制)
接收者地址
以 wei 为单位转移的价值(十六进制)
包含此追踪的区块的哈希
包含此追踪的区块号
调用结果
使用的燃料量(十六进制)
调用的输出数据(十六进制)
子追踪数量
调用树中追踪位置的地址路径
被追踪的交易的哈希
交易在区块中的索引位置
操作类型(call, create, suicide)
如果调用失败的错误消息(可选)
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"callType": "call",
"from": "0x83806d539d4ea1c140489a06660319c9a303f874",
"gas": "0x1a1f8",
"input": "0x",
"to": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
"value": "0x7a16c911b4d00000"
},
"blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add",
"blockNumber": 3068185,
"result": {
"gasUsed": "0x2982",
"output": "0x"
},
"subtraces": 2,
"traceAddress": [],
"transactionHash": "0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3",
"transactionPosition": 2,
"type": "call"
},
{
"action": {
"callType": "call",
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
"gas": "0x13e99",
"input": "0x16c72721",
"to": "0x2bd2326c993dfaef84f696526064ff22eba5b362",
"value": "0x0"
},
"blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add",
"blockNumber": 3068185,
"result": {
"gasUsed": "0x183",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": [0],
"transactionHash": "0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3",
"transactionPosition": 2,
"type": "call"
},
{
"action": {
"callType": "call",
"from": "0x1c39ba39e4735cb65978d4db400ddd70a72dc750",
"gas": "0x8fc",
"input": "0x",
"to": "0x70faa28a6b8d6829a4b1e649d26ec9a2a39ba413",
"value": "0x7a16c911b4d00000"
},
"blockHash": "0x7eb25504e4c202cf3d62fd585d3e238f592c780cca82dacb2ed3cb5b38883add",
"blockNumber": 3068185,
"result": {
"gasUsed": "0x0",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [1],
"transactionHash": "0x17104ac9d3312d8c136b7f44d4b8b47852618065ebfa534bd2d3b5ef218ca1f3",
"transactionPosition": 2,
"type": "call"
}
]
}
追踪树表示交易的执行流程:
traceAddress
)traceAddress
为 [0]
、[1]
等)traceAddress
为 [0, 0]
、[0, 1]
等)callType
字段可能有不同的值:
type
字段表示操作类型:
trace_replayTransaction