Internal transactions, also known as βsubcallsβ or βcontract calls,β represent interactions between smart contracts during the execution of a blockchain transaction.
These transactions can be accessed using the `debug_traceTransaction
` method in an Ethereum-compatible RPC interface.
## Using "debug_traceTransaction"
The `debug_traceTransaction
` method provides detailed information about all opcodes executed during the transaction. While this is comprehensive, it may be excessive if you only need internal transactions. By passing the parameter `{ "tracer": "callTracer" }
` , you can limit the output to only the internal transactions.
### Example Request
Below is an example of how to retrieve internal transactions using the `debug_traceTransaction
` method with the `callTracer
` parameter:
βx47}
curl --location 'https://ethereum-mainnet.gateway.tatum.io' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"jsonrpc":"2.0",
"method":"debug_traceTransaction",
"params":["0x16c52c58916c1e91736df3242f3c85a5bb597bcc648c7a2bd05555e8d054168c",
{
"tracer":"callTracer",
"timeout": "90s"
}
],
"id":1
}'
//Response:
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"from": "0x7830c87c02e56aff27fa8ab1241711331fa86f43",
"gas": "0x1e8480",
"gasUsed": "0x6bd4a",
"to": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43",
"input": "...",
"calls": [
**Key Fields in the Response**
`
from
`: The address initiating the internal transaction.`
to
`: The recipient address of the internal transaction.`
gas
`: The gas allocated for the internal transaction.`
gasUsed
`: The gas used by the internal transaction.`
value
`: The amount of Ether (or equivalent) transferred.`
type
`: The type of call (e.g., CALL, DELEGATECALL).
## Good to Know
Debug and Trace methods may require access to [Archival Data](πο»Ώ)ο»Ώ
The `
callTracer
` is efficient for extracting internal transactions but may still be resource-intensive for large transactions.A `
Timeout
` flag may be required in your request.Find the list of supported blockchains [HERE](πο»Ώ).
Find more about available authentication methods [HERE](πο»Ώ).