Last updated
Last updated
In this guide, you'll learn how to initialize a MANTRA-based Substreams project within the Dev Container.
If you prefer to begin locally within your terminal rather than through the Dev Container (VS Code required), refer to the .
Open the and follow the on-screen steps to initialize your project.
Running substreams init
will give you the option to choose between two MANTRA project options. Select the one that best fits your requirements:
MANTRA-minimal: Creates a simple Substreams that extracts raw MANTRA block data and generates corresponding Rust code. This path will start you with the full raw block, you can navigate to the substreams.yaml
(the manifest) to modify the input.
MANTRA-events: Creates a Substreams that extracts MANTRA events using the cached , filtered by one or more smart contract addresses. This includes type wasm
events.
Tip: Have the start block of your transaction or specific events ready.
Run substreams auth
to create your and generate an authentication token (JWT), then pass this token back as input.
Now you can freely use the substreams gui
to visualize and iterate on your extracted data.
Within the generated directories, modify your Substreams modules to include additional filters, aggregations, and transformations, then update the manifest accordingly. To learn more about this, visit the .
Run substreams codegen subgraph
to initialize the sink, producing the necessary files and function definitions.
Deploy
Run substreams codegen sql
and choose from either ClickHouse or Postgres to initialize the sink, producing the necessary files.
Run substreams-sink-sql
to sink the data into your selected SQL DB.
Note: Run help
to better navigate the development environment and check the health of containers.
You may find these additional resources helpful for developing your first MANTRA application.
To make your Substreams queryable (as opposed to ), you can automatically generate a Subgraph (known as a ) or SQL-DB sink.
Create your within the mappings.ts
and associated entities within the schema.graphql
.
Run substreams build
build the sink.
The helps you navigate the container and its common errors.
The lets you explore all the tools available in the Substreams CLI.
The dives deeper into navigating the substreams.yaml
.