Whitechain: trace (2/2)
API reference for Whitechain. All methods ->
Part 2 of 2: 1 · 2
trace_replayTransaction
Replays a transaction and returns the traces produced by its execution along with the state changes.
Available for Premium and Enterprise users only.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):transactionHash(string): the hash of the transaction to be replayed.traceTypes(array of strings): the types of traces to be included in the response. Possible value:trace.
Returns
The method returns an object that can include the following fields:
-
trace(array): an array of trace objects, similar to those returned bytrace_transactionandtrace_filter:-
action(object)- For
call:callType(string): the type of call (e.g., "call", "delegatecall", "staticcall").from(string): the address that initiated the call.to(string): the address that was called.gas(string): the amount of gas provided for the call.input(string): the input data for the call.value(string): the amount of Wei sent with the call.
- For
create:from(string): the address that created the contract.gas(string): the amount of gas provided for the creation.init(string): the initialization code for the contract.value(string): the amount of Wei sent with the creation.
- For
reward:author(string): the address that received the reward.value(string): the amount of Wei rewarded.rewardType(string): the type of reward (e.g., "block", "uncle").
- For
suicide:address(string): the address of the contract that self-destructed.refundAddress(string): the address that received the remaining balance.balance(string): the remaining balance of the contract.
- For
-
blockHash(string): the hash of the block containing the transaction. -
blockNumber(string): The number of the block containing the transaction. -
result(object)- For call:
gasUsed(string): The amount of gas used by the call.output(string): The output data from the call.
- For
create:address(string): The address of the created contract.code(string): The runtime code of the created contract.gasUsed(string): The amount of gas used by the creation.
- For
reward: No additional fields. - For
suicide: No additional fields.
- For call:
-
subtraces(integer): The number of subtraces (nested traces) generated by this trace. -
traceAddress(array of integers): The address within the trace hierarchy. -
transactionHash(string): The hash of the transaction containing the trace. -
transactionPosition(integer): The index position of the transaction within the block. -
type(string): The type of trace (e.g., "call", "create", "reward", "suicide").
-
Request example
curl -X POST https://rpc.ankr.com/whitechain_testnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "trace_replayTransaction",
"params": [
"0x640aea514f282b11450ae552807e19670ba1654300a164195d9bf2ebacfd7707",
[
"trace"
]
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
"stateDiff": null,
"trace": [
{
"type": "call",
"action": {
"from": "0xbd8258d5bb8e0484ad49b440477d958b25007cdd",
"callType": "call",
"gas": "0x8b4d",
"input": "0xa9059cbb000000000000000000000000ba2a19782476abeffc2d20c3f2472c0b2ce5edcb0000000000000000000000000000000000000000000000056bc75e2d63100000",
"to": "0xdccc102f943a108b12ec7221ee95940864d08d3c",
"value": "0x0"
},
"result": {
"gasUsed": "0x756a",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": []
}
],
"vmTrace": null
}
}
trace_replayBlockTransactions
Replays all the transactions in a given block and returns the traces produced by their execution along with the state changes.
Available for Premium and Enterprise users only.
Parameters
-
id(integer; required): a request ID (example: 1). -
jsonrpc(string; required): a JSON RPC spec used (example: 2.0). -
method(string; required): a method used for the request. -
params(array; required):blockHash(string): the hash of the block whose transactions you want to replay.traceTypes(array of strings): the types of traces to be included in the response. Possible value:trace.
Returns
The method returns an object that can include the following fields:
-
trace(array): an array of trace objects, similar to those returned bytrace_transactionandtrace_filter:-
action(object)- For
call:callType(string): the type of call (e.g., "call", "delegatecall", "staticcall").from(string): the address that initiated the call.to(string): the address that was called.gas(string): the amount of gas provided for the call.input(string): the input data for the call.value(string): the amount of Wei sent with the call.
- For
create:from(string): the address that created the contract.gas(string): the amount of gas provided for the creation.init(string): the initialization code for the contract.value(string): the amount of Wei sent with the creation.
- For
reward:author(string): the address that received the reward.value(string): the amount of Wei rewarded.rewardType(string): the type of reward (e.g., "block", "uncle").
- For
suicide:address(string): the address of the contract that self-destructed.refundAddress(string): the address that received the remaining balance.balance(string): the remaining balance of the contract.
- For
-
blockHash(string): the hash of the block containing the transaction. -
blockNumber(string): The number of the block containing the transaction. -
result(object)- For call:
gasUsed(string): The amount of gas used by the call.output(string): The output data from the call.
- For
create:address(string): The address of the created contract.code(string): The runtime code of the created contract.gasUsed(string): The amount of gas used by the creation.
- For
reward: No additional fields. - For
suicide: No additional fields.
- For call:
-
subtraces(integer): The number of subtraces (nested traces) generated by this trace. -
traceAddress(array of integers): The address within the trace hierarchy. -
transactionHash(string): The hash of the transaction containing the trace. -
transactionPosition(integer): The index position of the transaction within the block. -
type(string): The type of trace (e.g., "call", "create", "reward", "suicide").
-
Request example
curl -X POST https://rpc.ankr.com/whitechain_testnet/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "trace_replayBlockTransactions",
"params": [
"0x67df72",
[
"trace"
]
],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"output": "0x",
"stateDiff": null,
"trace": [
{
"type": "call",
"action": {
"from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
"callType": "call",
"gas": "0xee9b0",
"input": "0x3db6be2b000186a0000f4240000000000000000b000000006a98e0040000000000b15d50000000000000000000000000000000000000000000000000000000003c55d3760000000000000000000000000000000000000000000000000000000003294abfb0fa2b3a5ed9dc43c0da32f96707e5bd1d208fdb1898eb66169d05b2677edff00000000000000000000000007d451299ab21bfa7132c690b91d749756ec1dbb70000000000000000000000000190",
"to": "0x4200000000000000000000000000000000000015",
"value": "0x0"
},
"result": {
"gasUsed": "0x5c12",
"output": "0x"
},
"subtraces": 1,
"traceAddress": []
},
{
"type": "call",
"action": {
"from": "0x4200000000000000000000000000000000000015",
"callType": "delegatecall",
"gas": "0xe9b03",
"input": "0x3db6be2b000186a0000f4240000000000000000b000000006a98e0040000000000b15d50000000000000000000000000000000000000000000000000000000003c55d3760000000000000000000000000000000000000000000000000000000003294abfb0fa2b3a5ed9dc43c0da32f96707e5bd1d208fdb1898eb66169d05b2677edff00000000000000000000000007d451299ab21bfa7132c690b91d749756ec1dbb70000000000000000000000000190",
"to": "0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d30015",
"value": "0x0"
},
"result": {
"gasUsed": "0x489b",
"output": "0x"
},
"subtraces": 0,
"traceAddress": [
0
]
}
],
"vmTrace": null,
"transactionHash": "0xf975a5ee428e66b94c06203690764a2e42380160fd8ebaea40e9dd473b0a60a0"
},
{
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
"stateDiff": null,
"trace": [
{
"type": "call",
"action": {
"from": "0xbd8258d5bb8e0484ad49b440477d958b25007cdd",
"callType": "call",
"gas": "0x8b4d",
"input": "0xa9059cbb000000000000000000000000ba2a19782476abeffc2d20c3f2472c0b2ce5edcb0000000000000000000000000000000000000000000000056bc75e2d63100000",
"to": "0xdccc102f943a108b12ec7221ee95940864d08d3c",
"value": "0x0"
},
"result": {
"gasUsed": "0x756a",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": []
}
],
"vmTrace": null,
"transactionHash": "0x640aea514f282b11450ae552807e19670ba1654300a164195d9bf2ebacfd7707"
}
]
}