All tools
ChainToolsData collection Inspect

Chain Sight

Fetch validator and governance proposal data into PostgreSQL from the command line

View on GitHub
Best forbuilding chain datasets

Overview

Chain Sight is a command-line tool for fetching blockchain data — validators and governance proposals — and storing it in a PostgreSQL database.

Chain endpoints are imported once from a JSON file into the database; after that, validator or governance data for any configured chain can be fetched with a single command, ready for queries, dashboards and reports.

Key Features

  • Fetch validators — Retrieve validator data for a configured chain.
  • Fetch governance proposals — Retrieve governance proposal data for a configured chain.
  • Manage chain configurations — Import chain configurations from a JSON file and display what is stored in the database.
  • PostgreSQL storage — All fetched data is written to PostgreSQL.
  • Logging — Console and file logging with a configurable log file and level.

Installation

Database

  • Set up a PostgreSQL database.
  • Create a .env file with the connection string, e.g. DATABASE_URL=postgresql://user:password@localhost/chain_sight_db
git clone https://github.com/ChainTools-Tech/chain_sight.git
cd chain_sight
pip install -r requirements.txt

Chain Configuration

chains.json lists the chains to work with and their endpoints:

{
  "chains": [
    {
      "name": "Beezee",
      "chain_id": "beezee-1",
      "prefix": "bze",
      "rpc_endpoint": "https://rpc.beezee.chaintools.tech",
      "api_endpoint": "https://api.beezee.chaintools.tech",
      "grpc_endpoint": "https://grpc.beezee.chaintools.tech"
    }
  ]
}

Workflow

1. Import chain configurations

chain_sight --config import --config-path /path/to/chains.json

2. Display stored configurations

chain_sight --config display

3. Fetch validator data

chain_sight --fetch validators --chain beezee-1

4. Fetch governance proposals

chain_sight --fetch governance --chain beezee-1

Options

OptionDescription
--config import|displayImport chain configurations from JSON, or display those stored in the database
--config-pathJSON file to import (with --config import)
--fetch validators|governanceFetch validator or governance proposal data
--chainChain ID to fetch for; must match an imported configuration
--log-fileLog file path (default chain_sight.log)
--log-levelDEBUG, INFO (default), WARNING, ERROR or CRITICAL

Related Resources

Need something custom?

We build tooling and automation for node operators and chain teams, and can help you deploy or adapt this tool to your setup.