transfer(address,uint256), and a balanceOf call in its mapping indexed from a recent block and stayed within one block of the chain head. To index a forked copy of a network instead, see Index a Virtual Environment with The Graph.
Before you begin
- A Node RPC URL for your network, from the Integrate view of Node RPC in the Tenderly Dashboard
- A subgraph and the
docker-compose.ymlthatgraph initgenerates for it (see Set up Graph Node and the subgraph; the scaffolding steps are the same for a public network)
Configure the Ethereum provider
In the generateddocker-compose.yml, set ethereum in the graph-node service to <network>:archive,traces:<Node RPC URL>. The network name before the first colon must match network in subgraph.yaml.
docker-compose.yml (graph-node environment)
${TENDERLY_NODE_ACCESS_KEY} from your shell, so the access key stays out of the file:
capabilities: archive, traces for the provider and Provider supports block receipts, which means it fetches all receipts of a block with one eth_getBlockReceipts request.
Graph Node assumes both capabilities when the
ethereum value has none (mainnet:<url>). Declare them explicitly so the configuration shows what the subgraph relies on.
Keep ETHEREUM_REORG_THRESHOLD at its default of 250 on public networks. Graph Node uses it to roll back blocks when the network reorganizes, so don’t copy the value of 1 from a Virtual Environment setup.
Check that your network serves trace_filter
Call handlers needtrace_filter, which not every network on Node RPC serves. Request one recent block:
result means call handlers work on that network. An error such as the method trace_filter does not exist/is not available or Method not found means they don’t; index the contract’s events with eventHandlers instead. Pass block numbers as hex, because trace_filter rejects the latest tag with Invalid params.
Requests Graph Node sends
Graph Node polls Node RPC continuously, so every indexed network uses requests even when no subgraph has new events. See Node RPC pricing for the cost of each request category.
Call handlers are the most expensive part of a typical subgraph on Node RPC, because a trace request costs more than a read or a contract call. When the contract emits an event for the same action, index the event instead. Raise
ETHEREUM_POLLING_INTERVAL to poll less often when a few seconds of indexing delay are acceptable.
Troubleshooting
Related
- Node RPC overview
- Node RPC pricing
- RPC reference for
trace_filter - Index a Virtual Environment with The Graph for indexing a forked network