Skip to content

Commit bb4c13c

Browse files
azf20benface
andauthored
Substreams-powered subgraphs updates (#446)
* streamline example setup, add note on supported networks * link out to more examples * code styling for consistency Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com> --------- Co-authored-by: Benoît Rouleau <benoit.rouleau@icloud.com>
1 parent 2f2a5fa commit bb4c13c

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

website/pages/en/cookbook/substreams-powered-subgraphs.mdx

+19-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ title: Substreams-powered subgraphs
44

55
[Substreams](/substreams/README) is a new framework for processing blockchain data, developed by StreamingFast for The Graph Network. A substreams modules can output entity changes, which are compatible with Subgraph entities. A subgraph can use such a Substreams module as a data source, bringing the indexing speed and additional data of Substreams to subgraph developers.
66

7-
> This cookbook uses this [Substreams-powered subgraph as a reference](https://github.com/graphprotocol/graph-tooling/tree/main/examples/substreams-powered-subgraph).
8-
97
## Requirements
108

11-
This cookbook requires [yarn](https://yarnpkg.com/) as well as [the dependencies necessary for local Substreams development](https://substreams.streamingfast.io/developers-guide/installation-requirements).
9+
This cookbook requires [yarn](https://yarnpkg.com/), [the dependencies necessary for local Substreams development](https://substreams.streamingfast.io/developers-guide/installation-requirements), and the latest version of Graph CLI (>=0.52.0):
10+
11+
```
12+
npm install -g @graphprotocol/graph-cli
13+
```
14+
15+
## Get the cookbook
16+
17+
> This cookbook uses this [Substreams-powered subgraph as a reference](https://github.com/graphprotocol/graph-tooling/tree/main/examples/substreams-powered-subgraph).
18+
19+
```
20+
graph init --from-example substreams-powered-subgraph
21+
```
1222

1323
## Defining a Substreams package
1424

15-
A Substreams package is composed of types (defined as [Protocol Buffers](https://protobuf.dev/)), modules (written in Rust), and a `substreams.yaml` file which references the types, and specifies how modules are triggered. [Learn more about Substreams development](/substreams/README).
25+
A Substreams package is composed of types (defined as [Protocol Buffers](https://protobuf.dev/)), modules (written in Rust), and a `substreams.yaml` file which references the types, and specifies how modules are triggered. [Visit the Substreams documentation to learn more about Substreams development](/substreams/README), and check out [awesome-substreams](https://github.com/pinax-network/awesome-substreams) and the [Substreams cookbook](https://github.com/pinax-network/substreams-cookbook) for more examples.
1626

1727
The Substreams package in question detects contract deployments on Mainnet Ethereum, tracking the creation block and timestamp for all newly deployed contracts. To do this, there is a dedicated `Contract` type in `/proto/example.proto` ([learn more about defining Protocol Buffers](https://protobuf.dev/programming-guides/proto3/#simple)):
1828

@@ -145,7 +155,11 @@ This generates a `spkg` file based on the package name and version from `substre
145155
146156
## Defining a Substreams-powered subgraph
147157

148-
Substreams-powered subgraphs introduce a new `kind` of data source, "substreams". Such subgraphs can only have one data source. This data source must specify the Substreams network, the Substreams package (`spkg`) as a relative file location, and the module within that Substreams package which produces subgraph-compatible entity changes (in this case `map_entity_changes`, from the Substreams package above). The mapping is specified, but simply identifies the mapping kind ("substreams/graph-entities") and the apiVersion.
158+
Substreams-powered subgraphs introduce a new `kind` of data source, "substreams". Such subgraphs can only have one data source.
159+
160+
This data source must specify the indexed network, the Substreams package (`spkg`) as a relative file location, and the module within that Substreams package which produces subgraph-compatible entity changes (in this case `map_entity_changes`, from the Substreams package above). The mapping is specified, but simply identifies the mapping kind ("substreams/graph-entities") and the apiVersion.
161+
162+
> Currently the Subgraph Studio and The Graph Network support Substreams-powered subgraphs which index `mainnet` (Mainnet Ethereum).
149163
150164
```yaml
151165
specVersion: 0.0.4

website/pages/en/developing/supported-networks.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ import { getSupportedNetworks } from '@/src/getSupportedNetworks'
3131

3232
The hosted service relies on the stability and reliability of the underlying technologies, namely the provided JSON RPC endpoints.
3333

34-
You will **not be able** to publish a subgraph that indexes a non-mainnet network to the decentralized Graph Network in [Subgraph Studio](/deploying/subgraph-studio).
35-
3634
Ropsten, Rinkeby and Kovan are being deprecated. Read more on the [Ethereum Foundation Blog](https://blog.ethereum.org/2022/06/21/testnet-deprecation). As of Feb 25th 2023, Ropsten, Rinkeby and Kovan are no longer supported by the Hosted Service. Goerli will be maintained by client developers post-merge, and is also supported by the Hosted Service. Developers who currently use Ropsten, Rinkeby or Kovan as their staging/testing environment are encouraged to migrate to Goerli.
3735

3836
Subgraphs indexing Gnosis Chain can now be deployed with the `gnosis` network identifier. `xdai` is still supported for existing hosted service subgraphs.
3937

40-
For a full list of which features are supported on the decentralized network, see [this page](https://github.com/graphprotocol/indexer/blob/main/docs/networks/mainnet.md#feature-support).
38+
For a full list of which features are supported on the decentralized network, see [this page](https://github.com/graphprotocol/indexer/blob/main/docs/feature-support-matrix.md).
39+
40+
Substreams-powered subgraphs indexing `mainnet` Ethereum are supported on the Subgraph Studio and decentralized network.
4141

4242
## Graph Node
4343

0 commit comments

Comments
 (0)