Quickstart
This quickstart guide presents a simplified method for development environment setup and for running a squid that queries Kusama.
The steps outlined in this guide should only take around five minutes.
Pre-requisites
Before getting to work on your very first squid, verify that you have installed the following software:
- Node v16.x
- Docker
- GNU Make
Please note:
- The squid template is not compatible with
yarn
. Usenpm
instead. - Windows users are recommended to install WSL.
Additional information about development environment setup is available here.
Step 1: Clone squid-template
git clone https://github.com/subsquid/squid-template.git
cd squid-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
}
}