Zeeve Documentation
  • Zeeve Platform
    • Manage Your Account
    • Manage Workspaces
    • Technical Support
  • Rollups
    • Polygon CDK zkRollups
      • Introduction
      • Quick Start Guide
        • Purchase Subscription
        • Create your zkRollup Chain
      • Manage CDK zkRollups
      • Demo Network
        • Details
        • Bridge
        • RPC Access
        • Deploy Contract
    • zkSync Hyperchain
      • Introduction
      • Quick Start Guide
        • Setup zkSync Hyperchain
      • Manage zkSync Hyperchain
      • Demo Network
        • Details
        • Bridge
        • Deploying Contract
        • Faucet
      • RPC Access
    • OP Stack
      • Introduction
      • Quick Start Guide
        • Setup OP Stack
      • Manage OP Stack
      • RPC Endpoints
      • Demo Network
        • Details
    • Arbitrum Orbit
      • Introduction
      • Quick Start Guide
        • Setup Arbitrum Orbit
      • Manage Arbitrum Orbit
      • RPC Endpoints
      • Demo Network
        • Details
  • Traceye
    • Shared Indexing
      • Hosted Subgraphs
        • Quick Start Guide
          • Purchase Subscription
        • Manage Hosted Subgraphs
          • Webhook
          • Settings
      • Hosted SubQuery
        • Quick Start Guide
          • Purchase Subscription
        • Manage Hosted SubQuery
          • Settings
    • Dedicated Indexing
      • Graph Nodes
        • Quick Start Guide
          • Purchase Subscription
        • Graph Node Manual
          • Deploy Graph Node
          • View Analytics
          • Manage Addon Services
          • Ledger Data Pruning
        • Subgraph Manual
          • Manage Subgraph
          • Webhook Management
          • Index Data Pruning
          • Settings
          • Substreams-Powered Subgraphs
      • Subquery Nodes
        • Quick Start Guide
          • Purchase Subscription
        • Subquery Node Manual
          • Deploy Subquery Node
          • View Analytics
          • Manage Addon Services
        • Subquery Manual
          • Manage Subquery
          • Settings
  • RPC Nodes
    • Deploy Your RPC Node
    • Manage Your RPC Node
      • Manage Node
      • Delete Node
  • Archive Nodes
    • Deploy Your Archive Node
    • Manage Your Archive Node
      • Manage Node
      • Delete Node
  • Validator Nodes
    • Deploy Your Validator Node
    • Manage Your Validator Node
      • Manage Node
    • Coreum
      • Deploy Coreum Validator Node
      • Manage Coreum Validator Node
        • Edit Validator Details
        • Unbound Token
        • Withdraw Reward and Commission
        • Change Reward Wallet
        • Enable Restake
        • Delete Node
    • Shido
      • Deploy Shido Validator Node
      • Manage Shido Validator Node
        • Analytics
        • Edit Validator Details
        • Unbound Tokens
        • Withdraw Reward and Commission
        • Change Reward Wallet
        • Delete Node
    • Beam L1
      • Deploy Beam L1 Validator Node
      • Manage Beam L1 Validator Node
Powered by GitBook
On this page
  • Enable Substreams
  • Manage Substreams
  • Prerequisites
  • Create Substreams-Powered Subgraphs
  • Deploy Substreams-Powered Subgraphs

Was this helpful?

  1. Traceye
  2. Dedicated Indexing
  3. Graph Nodes
  4. Subgraph Manual

Substreams-Powered Subgraphs

PreviousSettingsNextSubquery Nodes

Last updated 2 months ago

Was this helpful?

Boost your Subgraph’s efficiency and scalability by using Substreams to stream pre-indexed blockchain data.

Use a Substreams package (.spkg) as a data source to give your Subgraph access to a stream of pre-indexed blockchain data. This enables more efficient and scalable data handling, especially with large or complex blockchain networks.

Enable Substreams

Enable Substreams-Powered Subgraphs for a blockchain network in Graph Node. See .

Manage Substreams

Prerequisites

All commands should be executed as the root user to ensure proper installation and permissions.

Nodejs

Nodejs is required for dependency management and build steps in the subgraph process.

apt install nodejs

Substreams CLI

The Substreams CLI is used for connecting to blockchain endpoints, streaming real-time data, and packaging custom modules.

LINK=$(curl -s https://api.github.com/repos/streamingfast/substreams/releases/latest | \
awk "/download.url.*linux_$(uname -m | sed s/aarch64/arm64/)/ {print \$2}" | sed 's/"//g')

echo Downloading $LINK

curl -L $LINK | tar zxf -

mv substreams /usr/bin/substreams

Buf

Buf is used to generate typed structures from Protobuf definitions, simplifying integration across various languages.

An internet connection is required for generating Rust bindings.

  1. Direct Download

LINK=$(curl -s https://api.github.com/repos/bufbuild/buf/releases/latest | \
awk "/download.url.*buf-Linux-$(uname -m)\"/ {print \$2}" | sed 's/"//g')

echo Downloading $LINK

curl -L $LINK -o /usr/bin/buf
  1. Using npm

npm install @bufbuild/buf

Rust

A complete Rust environment is necessary for developing Substreams modules.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

source $HOME/.cargo/env

Create Substreams-Powered Subgraphs

There are two methods of creating Substreams-Powered Subgraphs:

You can choose where to place your logic, either in the Subgraph or Substreams. However, consider what aligns with your data needs, as Substreams has a parallelized model, and triggers are consumed linearly.

Deploy Substreams-Powered Subgraphs

Before deploying a substream-powered subgraph, ensure substream are enabled for the blockchain network in Graph Node.

  1. Add Rust Target

rustup target add wasm32-unknown-unknown
  1. Generate Protobuf Types

substreams protogen

This command generates types in /src/pb.

  1. Build Substreams

substreams build

This command creates a Substream package (.spkg), which can be used as a data source for a subgraph to access pre-indexed blockchain data streams.

  1. Generate Subgraph Project

substreams codegen subgraph
  1. Navigate to the Subgraph Directory

Edit the following files as needed:

  • mappings.ts

  • schema.graphql

  • subgraph.yaml

  1. Install Dependencies

npm install
  1. Generate AssemblyScript & Protobuf Bindings

npm run generate
  1. Build Subgraph

npm run build

Using Substreams : Consume from any Substreams module by importing the Protobuf model through a Subgraph handler and move all your logic into a Subgraph. This method creates the Subgraph entities directly in the Subgraph.

Using : By writing more of the logic into Substreams, you can consume the module’s output directly into Subgraph. In Subgraph you can use the Substreams data to create your Subgraph entities.

The final step is to deploy the subgraph using the deployment command. See

Deploy Graph Node
triggers
Entity Changes⁠
Manage Subgraph