This repo contains the code to run an indexer see ./squid
and a front-end, see ./packages/ui
.
You can run most of the project locally, except for the database that will run in a docker.
You need to set up the squid/.env
file to tell the indexer what network to index. The following environment variables are expected. You can copy packages/squid/.env.example
into packages/squid/.env
as follow:
DB_PORT=5432
GQL_PORT=4350
SQD_DEBUG=sqd:processor:mapping
# rococo
BLOCK_START=3510000 # this is the starting block of the indexer
PREFIX=42 # the ss58 prefix for the chain
RPC_WS="wss://rococo-rpc.polkadot.io" # a WS endpoint to connect to the blockchain
ARCHIVE_NAME="rococo" # the archive name from subsquid archives
CHAIN_ID='rococo' # the name that will prefix most ids in the indexer's DB
Install and launch the indexer and its DB. This will block the terminal
cd squid;
npm install;
docker compose up db -d;
npm run codegen;
npm run build;
npm run db:migrate;
npm run start:indexer # this will start the indexer using the environment variables set in your .env
# alternatively, you can run with predefined values, see in /squid/assets/envs/, e.g here with polkadot
node -r dotenv/config lib/main dotenv_config_path=assets/envs/.env.polkadot
In the squid directory but another terminal window, run the graphql server
npm run start:graphql-server
From the repository root
# install all dependencies
yarn;
# install and launch the db in a docker
yarn ui:start