Search
⌃K

Manifest

StreamingFast Substreams manifest

Manifest Overview

The manifest contains the details for the various aspects and components of a Substreams module.
Every Substreams module contains one manifest. The manifest is a YAML-based file and provides vital insights into the blockchain being targeted, the design of the data flow, the names and types of modules, and locations and names for protobuf definitions.
Tip: Additional detailed information for manifests is available in the Substreams reference section.

Example manifest

The manifest from the Substreams Template example is used in the Substreams documentation.
Note: Learn more about Substreams manifests and different blockchains through the list of maintained Substreams examples provided by StreamingFast
  • The example manifest in the Substreams documentation is specific to the Ethereum blockchain.
substreams.yaml
1
specVersion: v0.1.0
2
package:
3
name: 'substreams_example'
4
version: v0.1.0
5
6
imports:
7
eth: https://github.com/streamingfast/sf-ethereum/releases/download/v0.10.2/ethereum-v0.10.4.spkg
8
9
protobuf:
10
files:
11
- erc721.proto
12
importPaths:
13
- ./proto
14
15
binaries:
16
default:
17
type: wasm/rust-v1
18
file: ./target/wasm32-unknown-unknown/release/substreams_example.wasm
19
20
modules:
21
- name: map_transfers
22
kind: map
23
initialBlock: 12287507
24
inputs:
25
- source: sf.ethereum.type.v2.Block
26
output:
27
type: proto:eth.erc721.v1.Transfers
28
29
- name: store_transfers
30
kind: store
31
initialBlock: 12287507
32
updatePolicy: add
33
valueType: int64
34
inputs:
35
- map: map_transfers
View the substreams.yaml file in the repository.

Manifest walkthrough

Tip: When writing and checking your substreams.yaml file, it may help to check your manifest against our JSON schema to ensure there are no problems. JSON schemas can be used in Jetbrains and VSCode. Our manifest schema can be seen here.

imports.eth

Substreams consumes blocks and depends on a Substreams package matching the target blockchain. The package is referenced by imports.
Note: The Substreams Template references a package specific to the Ethereum blockchain, referenced in the manifest as ethereum-v0.10.4.spkg. The Solana SPL Token Transfers manifest references solana-v0.1.0.spkg.

protobuf.files

The protobuf.files contains a list of protobuf files for the current Substreams module.
Note: The Substreams Template references the Ethereum-specific erc721.proto protobuf while the Solana SPL Token Transfers example references the Solana-specific solana_spl.proto.

protobuf.importPaths

The protobuf.importPaths contains the paths to the protobufs for the current Substreams module.

Module definitions

The manifest defines a list of modules used in the Substreams module.
The modules are Rust functions containing the business logic for the module.
Note: The manifest in the Substreams Template example lists two modules: map_transfers and store_transfers. The official naming convention for Substreams modules prefixes the module name by using map_ or store_ depending on the type.

map_transfers

The map_transfers module extracts all ERC721 transfers related to a specific smart contract address. The module receives Ethereum blocks as sf.ethereum.type.v2.Block.
The output for the map_transfers module is a list of ERC721 transfers. The business logic for map_transfers module is written as a Rust function.
Note: The initialBlock is set to 12287507 in the Substreams Template example because the first transfers of tokens originated from the contracts at that block.

store_transfers

The store_transfers store module receives transfers in the blocks extracted by the mapper. The store is a count of ERC721 tokens for a holder.
The inputs of the module are protobuf models defined as: proto:eth.erc721.v1.Transfers.
The eth.erc721.v1.Transfers protobuf module represents a list of ERC721 transfers in a block.
Note: The eth.erc721.v1.Transfers protobuf module is also used as the output for the map module.
The store's valueType is int64 and the merge strategy is add.