Comment on page
Manifest
StreamingFast Substreams manifest
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.
Note: Learn more about Substreams manifests and different blockchains through the list of maintained Substreams examples provided by StreamingFast
substreams.yaml
1
specVersion: v0.1.0
2
package:
3
name: "substreams_template"
4
version: v0.1.0
5
6
protobuf:
7
files:
8
- erc721.proto
9
importPaths:
10
- ./proto
11
12
binaries:
13
default:
14
type: wasm/rust-v1
15
file: ./target/wasm32-unknown-unknown/release/substreams.wasm
16
17
modules:
18
- name: map_transfers
19
kind: map
20
initialBlock: 12287507
21
inputs:
22
- source: sf.ethereum.type.v2.Block
23
output:
24
type: proto:eth.erc721.v1.Transfers
25
26
- name: store_transfers
27
kind: store
28
initialBlock: 12287507
29
updatePolicy: add
30
valueType: int64
31
inputs:
32
- map: map_transfers
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.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
.The
protobuf.importPaths
contains the paths to the protobufs for the current 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.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.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.