Skip to content

Syncs all the public info from an ixo blockchain to an instance of PostgreSQL.

License

Notifications You must be signed in to change notification settings

ixofoundation/ixo-blocksync

Repository files navigation

ixo-blocksync

ixo GitHub GitHub repo size License: Apache 2.0

PostgresExpress.jsNodeJSTypeScriptPrismaDockerGraphQL

Syncs all the public info from an ixo blockchain to an instance of PostgreSQL. It gets fed from a ixo-blocksync-core database in order to speed up indexing and put less strain on nodes, which means you need an ixo-blocksync-core database connection in order to run this.

For now the only source for information is a ixo-blocksync-core database connection, but we plan on expanding that to different sources in the near future.

Run

From Source

Requirements

git clone https://github.com/ixofoundation/ixo-blocksync.git
cd ixo-blocksync/

Copy .env.example to .env and configure. If this step is skipped, ixo-blocksync will use .env.example as the configuration by default.

  • Create a database called Blocksync
npm install
npx prisma migrate reset
npx prisma generate
npm run build
npm start

Using Docker (with Compose)

Requirements

git clone https://github.com/ixofoundation/ixo-blocksync.git
cd ixo-blocksync/

Copy .env.example to .env and configure. If this step is skipped, ixo-blocksync will use .env.example as the configuration by default. Don't use quotations when asign env vars for docker
Delete the seed folder in src/seed/* if you do not plan to import data from json
Create a role(e.g. app_user) in the DB for postgress to work

docker build -t ixofoundation/ixo-blocksync:latest .
docker compose up -d

API interface

The server exposes a Graphql api endpoint at /graphql which is set up using Postgraphile along with some plugins:

A graphiql playground gets exposed at the endpoint /graphiql where you can play around, test queries and see the schemas.

We also generate and expose the full graphql schema file (schema.graphql) under the endpoint /api/graphql_schema if you need it to generate clients.