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 # 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;
# start Multix UI (accessible on localhost:3333 per default)
yarn ui:start
Make sure you have docker.
# install all dependancies
yarn && cd squid && npm ci
# go back to the root
cd ..
# Launch the full setup. It will:
# - delete any previous Chopsticks database
# - launch a docker with the indexer db
# - launch a Chopsticks node
# - build and launch a subsquid indexer pointed at Chopsticks
# - launch a graphQL server for the squid
# - launch the UI with local env pointed at Chopsticks
rm db.sqlite*; npm run start:chopsticks-test-build-and-launch-all
yarn ui:test