Skip to main content
Version: Firesquid

Quickstart: Substrate chains

This guide follow through the steps to set up the environment, clone, build and run a template squid for substrate networks. The squid indexes transfers on the Kusama network. It is intended to be a stepping stone for building a custom squid for any Substrate-based chain.

Pre-requisites

Before getting to work on your very first squid, verify that you have installed the following software:

Please note:

  • The squid template is not compatible with yarn. Use npm instead.
  • Windows users are recommended to install WSL.

Additional information about development environment setup is available here.

Step 1: Clone squid-substrate-template

git clone https://github.com/subsquid/squid-substrate-template.git
cd squid-substrate-template

Step 2: Install dependencies

npm ci

Step 3: Build the squid

make build

Step 4: Launch Postgres and detach

make up

Step 5: Create the database schema and run the processor

The squid we have just built ingests pre-indexed data from a Kusama Archive. This data is then transformed, as defined by the data handler in processor.ts.

This command will keep the console busy until manually terminated:

make process

Step 6: Start the GraphQL server

This should be run in a separate terminal window:

make serve

The GraphQL playground is available at http://localhost:4350/graphql. Open it in a browser and run sample queries by applying filters and data selections in the panel to the left.

query MyQuery {
accountsConnection(orderBy: id_ASC) {
totalCount
}
}

What's next?