Etherscan
Etherscan is a popular Ethereum blockchain explorer. It provides a public API to fetch ABIs of verified contracts. DipDup can use its API to fetch ABIs for contracts being indexed.
Explorers of other EVM networks (e.g. BscScan, PolygonScan) are usually based on Etherscan and have similar APIs.
To use this datasource, add the following section in config:
datasources:
etherscan:
kind: abi.etherscan
url: ${ETHERSCAN_URL:-https://api.etherscan.io/api}
api_key: ${ETHERSCAN_API_KEY:-''}
During initialization, DipDup will use this datasource to fetch contract ABIs. If your config contains definitions for multiple networks, you can assign the datasource explicitly in evm.subsquid
index definitions:
indexes:
evm_events:
kind: evm.events
abi:
- etherscan
...
Authorization
If you have an Etherscan API key, you can set it in config. You may also want to increase the ratelimit according to your subscription plan. Otherwise, you will be limited to 5 requests per second.
etherscan:
kind: abi.etherscan
url: ${ETHERSCAN_URL:-https://api.etherscan.io/api}
api_key: ${ETHERSCAN_API_KEY:-''}
http:
ratelimit_period: 1
ratelimit_rate: 10