For the complete documentation index, see llms.txt. This page is also available as Markdown.

Manifests

StreamingFast Substreams manifests reference

This reference documentation provides a guide for all fields and values used in a Substreams manifest.

Manifests overview

In simple terms, a Substreams manifest (substreams.yaml) is a configuration file (a YAML file) for your Substreams. The manifest file is used for defining properties specific to the current Substreams module and identifying the dependencies between the inputs and outputs of modules. For example, the following manifest receives a raw Ethereum block as input (sf.ethereum.type.v2.Block) and outputs a custom object (eth.example.MyBlock).

modules:
  - name: map_block
    kind: map
    initialBlock: 12287507
    inputs:
      - source: sf.ethereum.type.v2.Block
    output:
      type: proto:eth.example.MyBlock

Among other things, the manifest allows you to define:

  • How many modules your Substreams uses, along with their corresponding inputs and outputs.

  • The schema(s) (i.e. the data model) your Substreams uses.

  • How you will consume the data emitted by your Substreams (SQL, Webhooks...).

specVersion

Excerpt pulled from the example Substreams manifest.

Use v0.1.0 for the specVersion field.

package

Excerpt pulled from the example Substreams manifest.

package.name

The package.name field is used to identify the package.

The package.name field infers the filename when the pack command is run by using substreams.yaml as a flag for the Substreams package.

The content of the name field must match the regular expression: ^([a-zA-Z][a-zA-Z0-9_-]{0,63})$. For consistency, use the snake_case naming convention.

The regular expression ruleset translates to the following:

  • 64 characters maximum

  • Starts with a-z or A-Z, and can contain numbers, _, and - thereafter

package.version

The package.version field identifies the package for the Substreams module.

Note: Thepackage.version must respect Semantic Versioning, version 2.0

package.url

The package.url field identifies and helps users discover the source of the Substreams package.

package.description

The package.description field is a short, one-line description of the package, shown by substreams info and in the Substreams Registry.

package.doc

The package.doc field is the documentation string of the package. The first line is used by the different UIs as a short-form description.

This field should be written in Markdown format.

package.image

The package.image field is the path to the icon displayed for the package in the Substreams Registry. The path is relative to the folder that contains the manifest. The file must be a JPEG, WebP, or PNG image of 2 MiB or less.

imports

The imports section allows you to import third-party Substreams packages. It adds local references to modules in those packages, and pulls WASM code, Protobuf and modules into the current Package.

Relying on imports rather than copying source code from third-party packages allows you to leverage server-side caches, and lower your costs.

Example:

Note the : separator that signifies to use the imported namespace, as defined under imports.

The filename can be absolute or relative or a remote path prefixed by http:// or https://. It can also be an IPFS reference.

A registry package is written <package>@<version> or, for a package published under an organization, <org>/<package>@<version>. The version is required, and @latest is refused, so that the same manifest keeps building the same package. When a file or directory named like <org>/<package> exists next to the manifest, it is read instead; prefix a path with ./ to make it unambiguous.

Environment variables

A handful of manifest fields support environment variable expansion using the $VAR or ${VAR} syntax:

  • imports locations

  • protobuf.importPaths

  • the foundational-store module input

This is convenient to author a manifest with a placeholder that is filled in later, for example a hosted-store deployment id:

Expansion happens when the manifest is packed or loaded. If a referenced variable is not set in the environment, the operation fails with an error rather than substituting an empty value.

protobuf

The protobuf section points to the Google Protocol Buffer (protobuf) definitions used by the Rust modules in the Substreams module.

The Substreams packager loads files in any of the listed importPaths.

protobuf.excludePaths

The excludePaths field lists .proto files or directories that substreams build and substreams protogen skip when generating Rust code, for example sf/substreams or google. Use it for types that come from a crate you already depend on. The --exclude-paths flag of substreams protogen takes precedence over this field.

Note: The imports section of the manifest also affects which .proto files are used in the final Substreams package.

Protobufs and modules are packaged together to help Substreams clients decode the incoming streams. Protobufs are not sent to the Substreams server in network requests.

Learn more about Google Protocol Buffers in the official documentation provided by Google.

protobuf.descriptorSets

The descriptorSets field allows you to import precompiled Protocol Buffer definitions from the Buf Schema Registry (BSR). This is useful when you want to consume protobuf types from external packages without copying .proto files into your project.

Descriptor sets are precompiled binary representations of protobuf schemas that can be directly loaded by Substreams, enabling efficient type resolution and validation.

Note: Using descriptorSets is an alternative to specifying .proto files via the files and importPaths fields. You can use both approaches in the same manifest if needed.

Format 1: Separate version field

Format 2: Inline version with @ notation

Available Fields:

  • module (required): The full path to the Buf module in the format buf.build/organization/repository. Can optionally include the version using @version notation.

  • version (optional): Either a valid semantic version (e.g., v0.1.0, v1.2.3) or latest.

  • symbols (optional): An array of specific protobuf symbols to import from the descriptor set. If omitted, all types from the descriptor set are available.

  • localPath (optional): Local filesystem path where the descriptor set should be cached or stored.

Complete Example with All Fields:

Version Validation Rules:

binaries

The binaries field specifies the WASM binary code to use when executing modules.

The modules[].binary field uses a default value of default.

See the binary field under modules to see its use.

binaries[name].type

The type of code and implied virtual machine for execution. The supported values are:

  • wasm/rust-v1: a Rust module compiled to wasm32-unknown-unknown. This is the standard type.

  • wasip1/tinygo-v1 (alpha): a Go module compiled with TinyGo to the wasi target. substreams build compiles it with tinygo build -o main.wasm -target wasi -gc leaking -scheduler none ..

A type can take runtime extensions, appended after a + and separated by commas. The only available extension is wasm-bindgen-shims, for wasm/rust-v1:

Enable wasm-bindgen-shims when your Rust code depends on crates such as solana_program or alloy, which add wasm-bindgen imports to the compiled module. The shims satisfy those imports so the module loads. If the code calls one of those imports at run time, the module fails.

binaries[name].file

The binaries[name].file field references a locally compiled WASM module. Paths for the binaries[name].file field are absolute or relative to the manifest's directory. The standard location of the compiled WASM module is the root directory of the Substreams module.

binaries[name].build

The binaries[name].build field overrides the command that substreams build runs to compile the binary. The command runs in the manifest's directory and is split on spaces, without shell interpretation, so pipes, &&, and quoted arguments are not supported. When the field is omitted, wasm/rust-v1 binaries are built with cargo build --target wasm32-unknown-unknown --release.

sink

The sink field specifies the sink you want to use to consume your data (for example, a database).

Sink module

Specifies the name of the module that emits the data to the sink. For example, db_out or graph_out.

Sink type

Specifies the service used to consume the data. For example, sf.substreams.sink.sql.v1.Service for databases.

Sink config

Specifies the configuration specific to every sink. This field is different for every sink.

Database Config

  • schema: SQL file specifying the schema.

  • engine: postgres or clickhouse.

  • postgraphile_frontend.enabled: enables or disables the Postgraphile portal.

  • pgweb_frontend.enabled: enables or disables the PGWeb portal.

  • dbt_config: specifies the configuration of dbt engine.

    • enabled: enables or disabled the dbt engine.

    • files: path to the dbt models.

    • run_interval_seconds: execution intervals in seconds.

modules

This example shows one map module, named events_extractor and one store module, named totals :

Module name

The identifier for the module, prefixed by a letter, followed by a maximum of 63 characters of [a-zA-Z0-9_-]. The same rules applied to the package.name field applies to the module name, including the convention to use snake_case names. Because the name is also the Rust function name, a module that runs its own code cannot use -.

The module name is the reference identifier used on the command line for the substreams run command. The module name is also used in the inputs defined in the Substreams manifest.

The module name also corresponds to the name of the Rust function invoked on the compiled WASM code upon execution. The module name is the same #[substreams::handlers::map] as defined in the Rust code. Maps and stores both work in the same fashion.

Module initialBlock

The initial block for the module is where Substreams begins processing data for a module. The runtime never processes blocks prior to the one for any given module.

If all the inputs have the same initialBlock, the field can be omitted and its value is inferred by its dependent inputs.

initialBlock becomes mandatory when inputs have different values.

Module kind

There are three module types for modules[].kind:

  • map

  • store

  • blockIndex, a map whose output type is proto:sf.substreams.index.v1.Keys, used by other modules' blockFilter. It cannot take params inputs or have a blockFilter itself. See Indexes.

kind is required, unless the module sets use, in which case it must be omitted.

Module updatePolicy

Specifies the merge strategy for two contiguous partial stores produced by parallelized operations.

The values for modules[].updatePolicy are defined using specific rules stating:

  • set, the last key wins the merge strategy

  • set_if_not_exists, the first key wins the merge strategy

  • append, concatenates two keys' values

  • add, sum the two keys' values

  • min, min between two keys' values

  • max, max between two keys' values

  • set_sum, either set the value or sum the two keys' values

Module valueType

Specifies the data type of all keys in the store, and determines what WASM imports are available to the module and are able to write to the store.

The values for modules[].valueTypes can use various types including:

  • bigdecimal

  • bigfloat (kept for backward compatibility, prefer bigdecimal)

  • bigint

  • int64

  • float64

  • bytes

  • string

  • proto:path.to.custom.protobuf.Model

Module binary

An identifier referring to the binaries section of the Substreams manifest.

The modules[].binary field overrides which binary is used from the binaries declaration section. This means multiple WASM files can be bundled in the Package.

The default value for binary is default. Therefore, a default binary must be defined under binaries.

Module inputs

The inputs field is a list of input structures. Each object has exactly one of these keys:

You can find more details about inputs in the Developer Guide's section about Modules.

Module output

The value for type is always prefixed using proto: followed by a definition specified in the protobuf definitions, and referenced in the protobuf section of the Substreams manifest.

Module doc

This field should contain Markdown documentation of the module. Use it to describe how to use the params, or what to expect from the module.

Module blockFilter

The blockFilter field makes the module skip blocks, based on the keys emitted by a module of kind: blockIndex. A skipped block is not processed by the module, which saves the cost of decoding blocks that hold nothing of interest.

  • module: name of the blockIndex module to read keys from. Its initialBlock cannot be greater than the initialBlock of the filtered module.

  • query.string: the query to match against the block keys, for example evt_addr:0xa0b8 || evt_addr:0x1234. The && and || operators and parentheses are supported.

  • query.params: true: use the value of the module's params input as the query, so it can be changed with -p at run time. The module must have a params input.

Set exactly one of query.string or query.params. Setting blockFilter: {} means no filter, which is useful to remove the filter inherited through use.

See Block Filters for what a filter saves and how to use it well, and Indexes to write an index module.

Module use

The use field declares a module that runs the code of another module, already defined in this manifest or in an imported package. Use it to run the same module more than once with different params, initialBlock, or inputs, without writing any code. You can also use it to keep running a module from a previous version of your package: the module keeps its previous code, so its hash and its cached data stay the same. See Updating your Substreams.

The module copies the following from the used module:

  • kind, including updatePolicy and valueType for a store

  • output

  • the binary and the Rust function it calls

  • inputs, when the module has no inputs of its own. A params input keeps the used module's default value, which you can override under params.

  • blockFilter, when the module has no blockFilter of its own. Set blockFilter: {} to run without the inherited filter.

initialBlock is not copied: set it on the module, or let it be derived from the module's inputs, as for any other module. doc is not copied either.

A module that sets use cannot set kind, output, updatePolicy, valueType, or binary.

When you set inputs, they must match the inputs of the used module one by one, in the same order:

  • the same number of inputs

  • a source input has the same type

  • a store input has the same mode

  • a map input points to a module with the same output type

  • a params input stays a params input

Other modules, params, networks, and the sink refer to the new module by its own name.

params

The params mapping changes the default values for modules' parameterizable inputs.

You can override those values with the -p parameter of substreams run.

When rolling out your consuming code -- in this example, Python -- you can use something like:

which would be inserted just before starting the stream.

Params that are defined under networks do not need to be repeated here (their value will be overwritten)

network

The network field specifies the default network for this Substreams, for example mainnet or solana-mainnet. Clients use it to pick an endpoint, and it selects which entry of networks applies by default.

networks

The networks allows specifying per-network params and initialBlock for each module:

You can override values for modules imported from other .spkg.

Every local module specified under networks must have a value for each network

Last updated

Was this helpful?