Duniter squid

Duniter squid is an indexer for Duniter v2 based on the subsquid framework.

Install duniter-squid

Requirements

You need an archive node running on the same network. In the following, we will assume this archive node is available in the duniter_default network with the url ws://duniter-archive:9944.

Docker compose

The following docker-compose.yml allows you to start a duniter-squid node. Please look carefully at the # <--- comments. To see the name of the network of your archive node, look at docker network ls.

version: "3"

services:
  db:
    image: postgres:15
    volumes:
      - postgres-data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: squid
      POSTGRES_PASSWORD: postgres
  api:
    image: h30x/duniter-squid # <--- this is the current image to use
    environment:
      - DB_NAME=squid
      - DB_PORT=5432
      - DB_HOST=db
      - DB_PASS=postgres
      - GQL_PORT=4350
    ports:
      # GraphQL endpoint at port 4350
      - "127.0.0.1:4350:4350" # <--- this is your graphql endpoint and GraphiQL playground
    command: ["sqd", "serve:prod"]
    depends_on:
      - db
  processor:
    image: h30x/duniter-squid # <--- this is the current image to use
    environment:
      - DB_NAME=squid
      - DB_PORT=5432
      - DB_HOST=db
      - DB_PASS=postgres
      - RPC_ENDPOINT=ws://duniter-archive:9944
      - GENESIS_FILE=gdev.json
      - HISTORY_FILE=history.json
    # ports:
      # prometheus metrics exposed at port 3000
      # - "3000:3000"
    command: ["sqd", "process:prod"]
    depends_on:
      - db
    networks:
      - default # <--- allows the processor to connect to the postgres database
      - duniter # <--- allows the processor to connect to the duniter archive node

volumes:
  postgres-data:

networks:
  duniter:
    name: duniter-gdev-archive_default # <--- your network name might vary depending on your config / folder name
    external: true

When you are ready, run the compose with:

docker compose down -v && # <--- if you want to erase previously existing data \
docker compose up -d && # <--- to start the compose in detached mode \
docker compose logs -f # <--- to see the logs and follow them

Nginx config

Expose your 4350 port.

TODO websocket for subscriptions

Use duniter-squid

Go on your duniter-squid url (https://subsquid.gdev.coinduf.eu/graphql for example) and make your requests in the GraphiQL playground. Then use the requests in your client.