Closed shaswatsaloni closed 7 months ago
I think you want to get the callstack of the transaction, right?
Here is an example on a testnet transaction.
curl --location 'rpc_url' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0x23c97b5925b7012919584685e12cf6d05f549fe9547f7d5812f2e0fed87113ee",
{
"tracer": "flatCallTracer"
}
],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"callType": "call",
"from": "0xa85ddddceeab43dccaa259dd4936ac104386f9aa",
"gas": "0x7fffffffffffffff",
"input": "0xc245db0f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000009422d990acdc3f2b3aa3b97303ad3060f09d7ffc0000000000000000000000009d726a549824eb289c5495e65dd421e0a681842a0000000000000000000000009f1abc67bea4db5560371ff3089f4bfe934c36bc000000000000000000000000a087037fd6ef66740083692f34bf90828cf5f219000000000000000000000000a325fd3a2f4f5cafe2c151ee428b5ceded628193000000000000000000000000a85ddddceeab43dccaa259dd4936ac104386f9aa000000000000000000000000acf8bf98d1632e602d0b1761771049af21dd6597000000000000000000000000c3c97512421bf3e339e9fd412f18584e53138bfa000000000000000000000000d086d2e3fac052a3f695a4e8905ce1722531163c000000000000000000000000e9bf2a788c27dadc6b169d52408b710d267b9bff",
"to": "0x41acdfe786171824a037f2cd6224c5916a58969a",
"value": "0x0"
},
"blockHash": "0x5769cd6625af6f7486285373d2b75e39ea54f994b4319d39f0b5bbb96fb3a85c",
"blockNumber": 25806695,
"result": {
"gasUsed": "0x1890c",
"output": "0x"
},
"subtraces": 1,
"traceAddress": [],
"transactionHash": "0x23c97b5925b7012919584685e12cf6d05f549fe9547f7d5812f2e0fed87113ee",
"transactionPosition": 0,
"type": "call"
},
{
"action": {
"callType": "delegatecall",
"from": "0x41acdfe786171824a037f2cd6224c5916a58969a",
"gas": "0x7dfffffffffff512",
"input": "0xc245db0f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000009422d990acdc3f2b3aa3b97303ad3060f09d7ffc0000000000000000000000009d726a549824eb289c5495e65dd421e0a681842a0000000000000000000000009f1abc67bea4db5560371ff3089f4bfe934c36bc000000000000000000000000a087037fd6ef66740083692f34bf90828cf5f219000000000000000000000000a325fd3a2f4f5cafe2c151ee428b5ceded628193000000000000000000000000a85ddddceeab43dccaa259dd4936ac104386f9aa000000000000000000000000acf8bf98d1632e602d0b1761771049af21dd6597000000000000000000000000c3c97512421bf3e339e9fd412f18584e53138bfa000000000000000000000000d086d2e3fac052a3f695a4e8905ce1722531163c000000000000000000000000e9bf2a788c27dadc6b169d52408b710d267b9bff",
"to": "0x91f7e3d9835054bbad7798531942d12d44443347",
"value": "0x0"
},
"blockHash": "0x5769cd6625af6f7486285373d2b75e39ea54f994b4319d39f0b5bbb96fb3a85c",
"blockNumber": 25806695,
"result": {
"gasUsed": "0x17dcc",
"output": "0x"
},
"subtraces": 2,
"traceAddress": [
0
],
"transactionHash": "0x23c97b5925b7012919584685e12cf6d05f549fe9547f7d5812f2e0fed87113ee",
"transactionPosition": 0,
"type": "call"
}
...
}
You need to turn on debug APIs on your node and an archive node if you want to query old block/transaction. There are a lot of debug APIs and builtin tracers that you can play with. You can get more information here: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug and https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers.
@shaswatsaloni ronin doesn't support getting internal transactions natively, you can get the internal transactions by using the tracers
as @minh-bq mentioned above. Otherwise, you can query them via Skynet, you can find the instruction here:
https://docs.skymavis.com/api/ronin-rest/search-internal-transactions
Thanks, @minh-bq and @DNK90 , that helped.
Saloni.
Hi all,
Anyone can provide me with the Curl query or the method name to get the internal transaction based upon transaction hash or Block Number?
Thanks, Saloni