/ Docs
7.5
/

evm.subsquid.transactions index

Note
Examples below are for Ethereum mainnet. For other supported networks, see EVM Networks.

This index allows indexing EVM transactions and matching them with handlers by content. You can define handlers for multiple sets of filters. Only necessary transactions are processed.

Below is a basic indexer for USDt token contract transfers.

To create a project based on this template, run dipdup new -t demo_evm_transactions.

dipdup.yaml
spec_version: 2.0
package: demo_evm_transactions

datasources:
  subsquid:
    kind: evm.subsquid
    url: ${SUBSQUID_URL:-https://v2.archive.subsquid.io/network/ethereum-mainnet}
    node: evm_node
  etherscan:
    kind: abi.etherscan
    url: ${ETHERSCAN_URL:-https://api.etherscan.io/api}
    api_key: ${ETHERSCAN_API_KEY:-''}
  evm_node:
    kind: evm.node
    url: ${NODE_URL:-https://eth-mainnet.g.alchemy.com/v2}/${NODE_API_KEY:-''}
    ws_url: ${NODE_WS_URL:-wss://eth-mainnet.g.alchemy.com/v2}/${NODE_API_KEY:-''}

contracts:
  eth_usdt:
    kind: evm
    address: 0xdac17f958d2ee523a2206206994597c13d831ec7
    typename: eth_usdt

indexes:
  eth_usdt_transactions:
    kind: evm.subsquid.transactions
    datasource: subsquid
    handlers:
      - callback: on_transfer
        to: eth_usdt
        method: transfer
    first_level: 4634748

Filters

Transactions can be filtered by one or more of the following fields:

namedescriptionsupportedtyped
from.addressSender address🟢🔴
to.addressDestination address🟢🟢¹
methodInvoked contract method🟢🟢¹

¹ both contract address and method need to be specified

Typed and untyped arguments

You will get slightly different callback argument types depending on whether the pattern item is typed or not. If both "to" and "method" filters are specified, DipDup will generate a typeclass for particular input from contract ABI. Otherwise, you will have to handle untyped input data stored in SubsquidTransactionData and EvmNodeTransactionData models.

Using EVM node

DipDup indexes for EVM networks use Subsquid Network as a source of historical data. EVM nodes are not required for DipDup to operate, but they can be used to get the latest data (not yet in Subsquid Network) and realtime updates. See evm.subsquid and evm.node pages for more info on how to configure both datasources.

For testing purposes, you can enforce DipDup to use only data from EVM node by setting node_only flag in the index config.

dipdup.yaml
indexes:
  evm_index:
    kind: evm.subsquid.<index>
    node_only: true
Help and tips -> Join our Discord
Ideas or suggestions -> Issue Tracker