Introduction to Substreams-Powered Subgraphs
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.
Специфические особенности
There are two methods of enabling this technology:
-
Using Substreams triggers: 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 Entity Changes: By writing more of the logic into Substreams, you can consume the module’s output directly into graph-node. In graph-node, you can use the Substreams data to create your subgraph entities.
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 in the graph node.
Дополнительные ресурсы
Visit the following links for tutorials on using code-generation tooling to build your first end-to-end Substreams project quickly: