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)
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.
- crawl-account: get account auth and its balances
- crawl-block: get block from network and insert to DB
- crawl-transaction: get transaction in a block and decode to readable
- handle-authz-msg: handle authz message and decode to readable
- crawl-proposal: get proposal and its status
- crawl-validator: get validator and their power event, signing info
- crawl-genesis: get state from genesis chunk
- crawl-cosmwasm: get codes and contracts
- CW721: handle registed asset type CW721
- handle-vote: parse vote message
You can view detail database schema here
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
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
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
npm run dev
: Start development mode (load all services locally with hot-reload & REPL)npm run build
: Build .dist folder to start production modenpm run start
: Start production mode (setSERVICES
env variable to load certain services)npm run lint
: Run ESLintnpm run test
: Run jest