Home

Awesome

Grants Stack Indexer

The Grants Stack Indexer is a tool that indexes blockchain events generated by Allo contracts and serves the data over HTTP in JSON format. The data is organized in a specific structure that enables easy access to different parts of the protocol. The indexer is built using Chainsauce and is designed to work with any EVM-compatible chain.

The indexer data is used by Grants Stack as a data layer.

Indexer user docs featuring sample queries can be found at docs.allo.gitcoin.co.

API

Access indexed data through the GraphQL endpoint at:

https://grants-stack-indexer-v2.gitcoin.co/graphql

Use the GraphiQL Playground to inspect the schema:

https://grants-stack-indexer-v2.gitcoin.co/graphiql

Indexed chains are defined in config.ts.

Setup

Requires Node 18 minimum.

Copy .env.example to .env, review and optionally customize it.

To pick chains to index, set INDEXED_CHAINS to a comma-separated list of chain identifiers. Available chain identifiers can be found in src/config.ts.

Running in development

cp .env.example .env
docker-compose up -d
npm install
npm run build

npm run dev

# you can also pass arguments to the dev script

npm run dev -- --drop-db # drop the database before indexing
npm run dev -- --from-block=latest # start indexing from the last block
npm run dev -- --from-block=12345 # start indexing from the 12345th block
npm run dev -- --run-once # index and exit without watching for events
npm run dev -- --no-cache # disable cache
npm run dev -- --log-level=trace # set log level
npm run dev -- --port=8081 # start web service on a given port

Running in production

npm install
npm run build
npm run start # this will sync to the last block and then run the http server

Or use the provided Dockerfile.

Deployment

Check out this guide to deploy your own indexer on Fly.io.

We're currently continuously deploying the main branch into Fly.

There are a few things to consider when it comes to deploying your changes: