Skip to content

Commit 328cfaa

Browse files
authored
Update provider docs (#5216)
* update provider docs * fix firehose config
1 parent d4b6291 commit 328cfaa

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

docs/config.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,33 +100,52 @@ time the configuration is changed to make sure that the connection pools
100100
are what is expected. Here, `$all_nodes` should be a list of all the node
101101
names that will use this configuration file.
102102

103-
## Configuring Ethereum Providers
103+
## Configuring Chains
104104

105-
The `[chains]` section controls the ethereum providers that `graph-node`
105+
The `[chains]` section controls the providers that `graph-node`
106106
connects to, and where blocks and other metadata for each chain are
107107
stored. The section consists of the name of the node doing block ingestion
108-
(currently not used), and a list of chains. The configuration for a chain
109-
`name` is specified in the section `[chains.<name>]`, and consists of the
110-
`shard` where chain data is stored and a list of providers for that
111-
chain. For each provider, the following information must be given:
108+
(currently not used), and a list of chains.
112109

113-
- `label`: a label that is used when logging information about that
114-
provider (not implemented yet)
110+
The configuration for a chain `name` is specified in the section
111+
`[chains.<name>]`, with the following:
112+
113+
- `shard`: where chain data is stored
114+
- `protocol`: the protocol type being indexed, default `ethereum`
115+
(alternatively `near`, `cosmos`,`arweave`,`starknet`)
116+
- `polling_interval`: the polling interval for the block ingestor (default 500ms)
117+
- `provider`: a list of providers for that chain
118+
119+
A `provider` is an object with the following characteristics:
120+
121+
- `label`: the name of the provider, which will appear in logs
122+
- `details`: provider details
123+
124+
`details` includes the following:
125+
126+
- `type`: one of `web3` (default), `firehose`, `substreams` or `web3call`
115127
- `transport`: one of `rpc`, `ws`, and `ipc`. Defaults to `rpc`.
116128
- `url`: the URL for the provider
117129
- `features`: an array of features that the provider supports, either empty
118-
or any combination of `traces` and `archive`
130+
or any combination of `traces` and `archive` for Web3 providers, or
131+
`compression` and `filters` for Firehose providers
119132
- `headers`: HTTP headers to be added on every request. Defaults to none.
120133
- `limit`: the maximum number of subgraphs that can use this provider.
121134
Defaults to unlimited. At least one provider should be unlimited,
122135
otherwise `graph-node` might not be able to handle all subgraphs. The
123136
tracking for this is approximate, and a small amount of deviation from
124137
this value should be expected. The deviation will be less than 10.
138+
- `token`: bearer token, for Firehose and Substreams providers
139+
140+
Note that for backwards compatibility, Web3 provider `details` can be specified at the "top level" of
141+
the `provider`.
125142

126-
The following example configures two chains, `mainnet` and `kovan`, where
127-
blocks for `mainnet` are stored in the `vip` shard and blocks for `kovan`
143+
The following example configures three chains, `mainnet`, `sepolia` and `near-mainnet`, where
144+
blocks for `mainnet` are stored in the `vip` shard and blocks for `sepolia`
128145
are stored in the primary shard. The `mainnet` chain can use two different
129-
providers, whereas `kovan` only has one provider.
146+
providers, whereas `sepolia` only has one provider. The `near-mainnet` chain expects data from
147+
the `near` protocol via a Firehose, where the Firehose offers the `compression` and `filters`
148+
optimisations.
130149

131150
```toml
132151
[chains]
@@ -137,9 +156,14 @@ provider = [
137156
{ label = "mainnet1", url = "http://..", features = [], headers = { Authorization = "Bearer foo" } },
138157
{ label = "mainnet2", url = "http://..", features = [ "archive", "traces" ] }
139158
]
140-
[chains.kovan]
159+
[chains.sepolia]
141160
shard = "primary"
142-
provider = [ { label = "kovan", url = "http://..", features = [] } ]
161+
provider = [ { label = "sepolia", url = "http://..", features = [] } ]
162+
163+
[chains.near-mainnet]
164+
shard = "blocks_b"
165+
protocol = "near"
166+
provider = [ { label = "near", details = { type = "firehose", url = "https://..", token = "", features = ["compression", "filters"] } } ]
143167
```
144168

145169
### Controlling the number of subgraphs using a provider

0 commit comments

Comments
 (0)