/ Docs
7.5
/
Table of Contents

evm.subsquid.events index

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

This index allows processing events emitted by Ethereum smart contracts. You can define a handler for each contract/tag pair. Only necessary events 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_events.

dipdup.yaml
spec_version: 2.0
package: demo_evm_events

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_events:
    kind: evm.subsquid.events
    datasource: subsquid
    handlers:
      - callback: on_transfer
        contract: eth_usdt
        name: Transfer

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
Table of Contents