Skip to content

Constellation-Labs/block_explorer

Repository files navigation

Block Explorer

build version

The Block Explorer provides API functions to retrieve on-chain data from a Constellation Network indexer. The service uses PostgreSQL for data storage and retrieval and the Serverless framework for API deployment.

Table of Contents

Prerequisites

Quick Start

  1. Clone the repository

    git clone https://github.com/Constellation-Labs/block_explorer.git
    cd block_explorer
  2. Install dependencies

    npm install
  3. Start the PostgreSQL database

    npm run db:start
  4. Run the API locally

    serverless offline

Development

Database Setup

The project uses PostgreSQL for data storage. A Docker Compose configuration is provided for easy setup:

# Start the PostgreSQL container
npm run db:start

# To stop the container when finished
npm run db:stop

The database configuration is stored in .env and can be customized as needed.

API Development

Start the serverless offline host to test API endpoints locally:

serverless offline

This will display a list of available endpoints that can be called locally.

Testing

Run tests with the following commands:

# Start the database if not already running
npm run db:start

# Run tests (this will reset and seed the database automatically)
npm run test

The test suite uses Jest and automatically resets the database schema before each test run.

API Documentation

API endpoints are defined in the routes/ directory with their handlers in src/handlers/.

Available endpoints include:

  • DAG operations
  • Metagraph information
  • Token locks
  • Actions
  • Allow spends

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 10