Get Internal Transactions
Overview
The Get Internal Transactions endpoint obtains data on interactions with smart contracts by analyzing
their internal transactions. At least one of the following parameters must be specified: contract
, origin
,
sender
, or sig_hash
. The range should be defined by either block_number
, timestamp
, or block_hash
.
Internal transactions can be decoded and converted into a human-readable format when a smart contract's ABI
is provided.
Multiple values can be set for the contract
and sig_hash
parameters, with a maximum of five items each.
Use Cases
Several possible combinations of parameters should be considered, where origin
refers to the address
of an EOA wallet, contract
is a smart contract's address, and sender
represents either an EOA wallet's
address or a smart contract's address. To retrieve specific details about internal transactions and their
function calls, follow the guidelines below.
-
For calls of a particular function within a smart contract, specify both
sig_hash
andcontract
. -
For calls of a particular function within multiple smart contracts triggered by another smart contract, specify both
sig_hash
andsender
as a contract's address. -
For calls of a particular function initiated by an EOA wallet, specify
sig_hash
andorigin
. Includecontract
to narrow your query to a specific smart contract. -
For calls of a particular function within a smart contract triggered by another smart contract, specify
sig_hash
,contract
, andsender
. -
For calls of a particular function on a smart contract triggered by another contract but initiated by an EOA wallet, specify
sig_hash
,contract
,sender
, andorigin
.
When using decoding, the output will include a decoded object with the function name, its parameters and values.
Querying via Postman
If you prefer querying via Postman, the description of PARSIQ Endpoints for Get Internal Transactions (opens in a new tab) and Get Decoded Internal Transactions (opens in a new tab) might come in handy. There you will find examples and responses for good and bad requests as well as parameter definitions and their example values.
Usage
In this example, we receive internal transaction calls on the contract 0xdAC17F958D2ee523a2206206994597C13D831ec7
,
triggered by the sender
address 0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828
, initiated by the origin
address
0x36928500bc1dcd7af6a2b4008875cc336b927d57
, and filtered by the signature hash of the executeTransaction
function
0xa9059cbb
. The block range is set from block 1
to latest
.
import * as Parsiq from '@parsiq/parsiq.js';
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
const internalTransactions = client.internalTransactions.getByBlockRange(
1, 'latest',
{
contract: ['0xdAC17F958D2ee523a2206206994597C13D831ec7'],
sig_hash: ['0xa9059cbb'],
sender: '0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828',
origin: '0x36928500bc1dcd7af6a2b4008875cc336b927d57',
include_events: true
},
{
limit: 1
}
);
for await (const call of internalTransactions) {
console.log(call);
}
Output:
{
id: '000000000046c771-0085-00000001',
sender: '0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828',
sig_hash: '0xa9059cbb',
tx_hash: '0x2c22ad3e367ee78da808ffec1e03a677ebb30703ce6c4a72eaf7a6c529580d93',
block_hash: '0x25e8d1f5952a8387430629a5c94325749aacbd32f40061ab21b687300c3bf9d4',
block_number: 4638577,
timestamp: 1511883650,
origin: '0x36928500bc1dcd7af6a2b4008875cc336b927d57',
contract: '0xdac17f958d2ee523a2206206994597c13d831ec7',
value: '0',
input_data: '0xa9059cbb0000000000000000000000002b2c9153acc4021676c165dc3e3b1c7ad1c7849d000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000',
events: [
{
topic_0: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
op_code: 'LOG3',
topic_1: '0x000000000000000000000000c6cde7c39eb2f0f0095f41570af89efc2c1ea828',
topic_2: '0x0000000000000000000000002b2c9153acc4021676c165dc3e3b1c7ad1c7849d',
topic_3: null,
log_data: '0x0000000000000000000000000000000000000000000000000000000000989680',
contract: '0xdac17f958d2ee523a2206206994597c13d831ec7'
}
]
}
Parameters
chainId
version
block_number_start
block_number_end
origin
contract
sig_hash
sender
include_events
offset
limit
estimate_cu