Skip to main content
V2 gateway requests require an API key. Set SQD_API_KEY in .env before running gateway-based examples, or pass apiKey: process.env.SQD_API_KEY in GatewaySettings.
Traces for historical blocks are currently available from SQD Network on the same basis as all other data stored there: for free. If you deploy a squid that indexes traces in real-time to SQD Cloud and use our RPC addon, the necessary trace_ or debug_ RPC calls made will be counted alongside all other calls and the price will be computed for the total count. There are no surcharges for traces or state diffs.

addTrace(options)

Subscribe to execution traces. This allows for tracking internal calls. The options object has the following structure:
The data requests here are:
  • type: get traces of types from this set. Allowed types are 'create' | 'call' | 'suicide' | 'reward'.
  • callTo: get call traces to the addresses in this set.
  • callFrom: get call traces from the addresses in this set.
  • callSighash: get call traces with signature hashes in this set.
  • createFrom: get create traces from the addresses in this set.
  • rewardAuthor: get reward traces where block authors are in this set.
  • suicideRefundAddress: get suicide traces where refund addresses in this set.
  • range: get traces from transactions from this range of blocks.
Related data retrieval:
  • transaction = true will cause the processor to retrieve transactions that the traces belong to.
  • transactionLogs = true will cause the processor to retrieve all logs emitted by transactions that the traces belong to.
  • subtraces = true will cause the processor to retrieve downstream traces in addition to those that matched the data requests.
  • parents = true will cause the processor to retrieve upstream traces in addition to those that matched the data requests.
These extra data items will be added to the appropriate iterables within the block data. Note that traces can also be requested by addTransaction() and addLog() method as related data. Selection of the exact data to be retrieved for each trace item is done with the setFields() method documented on the Field selection page. Be aware that field selectors for traces do not share their names with the fields of trace data items, unlike field selectors for other data item types. This is due to traces varying their structure depending on the value of the type field.

Examples

Exploring internal calls of a given transaction

For a mint call to Uniswap V3 Positions NFT.

Grabbing addresses of all contracts ever created on Ethereum

Full code is available in this branch. WARNING: will contain addresses of some contracts that failed to deploy.
Currently there is no convenient way to check whether a trace had effect on the chain state, but this feature will be added in future releases.