Search…
⌃K

Manifest

StreamingFast Substreams manifest

Overview

The manifest contains the details for the various aspects and components of a Substreams implementation.
Every Substreams implementation 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 below is from the Substreams Template example accompanying the developer guide.
Note: The example manifest below is specific to the Ethereum blockchain. The Solana SPL Token Transfers example contains a manifest specific to the Solana 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: block_to_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: nft_state
30
kind: store
31
initialBlock: 12287507
32
updatePolicy: add
33
valueType: int64
34
inputs:
35
- map: block_to_transfers
36
View this file in the repo by visiting the following link.

Manifest Walkthrough

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 implementation.
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 implementation.

Module Definitions

The manifest defines a list of modules used in the Substreams implementation.
The modules are Rust functions containing the business logic for the implementation.
Note: The manifest in the Substreams Template example lists two modules: block_to_transfers and nft_state.

block_to_transfers

The block_to_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 blocks_to_transfers module is a list of ERC721 transfers. The business logic for block_to_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.

nft_state

The nft_state store module receives transfers in each block 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 stores valueType is int64 and the merge strategy is add.