Skip to content

Horoscope crawls data from Cosmos chains, stores and indexes everything into a Postgres for easy access from clients by GraphQL.

License

Notifications You must be signed in to change notification settings

aura-nw/horoscope-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Horoscope v2

Horoscope v2 is a next version of Horoscope, that is an indexing service for Cosmos-based blockchain. It crawls data from the blockchain and index it into Postgres. Based on the data, it can provide search functionality instead of querying data from LCD or RPC directly.

Currently, it supports network built by Cosmos SDK v0.45.1 or later. Supporting network:

Looking for Horoscope v1? The Horoscope v1 repository has been archived Horoscope v1.

Horoscope v2 includes 2 main components:

  • Crawler: crawl data from the blockchain and index it into Postgres
  • Backend API: provide search functionality through Hasura service (with GraphQL and RestAPI)

Overview Architecture

All services are small Node applications written in Typescript. The Node services are built using Moleculerjs framework with template moleculer. With crawler, we use Bull to manage the queue of crawling.

image

List services (currently)

Database schema

You can view detail database schema here

How to run

Horoscope currently use private packet aurajs to decode tx from Aura Network. To install aurajs, you must create a Personal Access Token has read package permission, put it to (xxx_xxx) on .npmrc file in root source code

@aura-nw:registry=https://npm.pkg.github.com/aura-nw
//npm.pkg.github.com/:_authToken=xxx_xxx

To install requirements (postgres, redis, hasura), use docker-compose:

docker-compose up

then start service

# create file env
cp .env.sample .env

# run with moleculer cli
npm run dev

Hasura metadata migration

Read link to install Hasura CLI for your operating system. To make update to hasura metadata programmatically, use sample code below:

# init hasura directory
hasura init hasura

# create file env hasura
cp .env.hasura.sample hasura/.env

# go to hasura directory
cd hasura

# export current metadata from hasura
hasura metadata export

# check current diff between local and hasura server
hasura metadata diff

# apply current hasura metadata to server
hasura metadata apply

Configuration

Config Moleculer, refer docs to get detail configurations
Config list network to config list network with LCD, RPC, database
Config chain to setup job crawl and select chain id to crawl

Scripts

  • npm run dev: Start development mode (load all services locally with hot-reload & REPL)
  • npm run build: Build .dist folder to start production mode
  • npm run start: Start production mode (set SERVICES env variable to load certain services)
  • npm run lint: Run ESLint
  • npm run test: Run jest

About

Horoscope crawls data from Cosmos chains, stores and indexes everything into a Postgres for easy access from clients by GraphQL.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages