Skip to main content
Version: Old ArrowSquid docs

Quickstart: Substrate chains

The substrate squid template indexes transfers on the Kusama network. It is intended to be a stepping stone for building a custom squid for any Substrate-based chain.


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.

Step 1: Scaffold from a template

Come up with a new memorable name for your squid. Choose the template matching your network and scaffold using sqd init.

  • For indexing native events emitted by Substrate-based chains, use substrate
  • For indexing Frontier EVM contracts on Astar and Shiden use frontier-evm
  • For indexing ink! smart contracts, use ink

For example:

sqd init my-awesome-squid --template substrate
cd my-awesome-squid

Step 2: Install dependencies

npm ci

Step 3: Launch Postgres in a detached Docker container

sqd up

Step 4: 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 supplied to the call in src/main.ts.

This command will keep the console busy until manually terminated:

sqd process

Step 5: Start the GraphQL server

Run in a separate terminal window:

sqd 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) {

Step 6: Customize

Hack the schema file schema.graphql and the processor to index the data your way. Pick an Archive for your network at the Supported networks page.

What's next?