Skip to content

gluwa/subscan-essentials

 
 

Repository files navigation

Subscan Essentials

License: GPL Go Report Card subscan

Subscan Essentials is a high-precision blockchain explorer scaffold project. It supports substrate-based blockchain networks with developer-friendly interface, standard or custom module parsing capabilities. It's developed by the Subscan team and used in subscan.io. Subscan Essentials is a high-precision blockchain explorer scaffold project. It supports substrate-based blockchain networks with developer-friendly interface, standard or custom module parsing capabilities. It's developed by the Subscan team and used in subscan.io. Developers are free to use the codebase to extend functionalities and develop unique user experiences for their audiences.

Contents

Feature

  1. Support Substrate network custom type registration
  2. Support Substrate network custom type registration
  3. Support index Block, Extrinsic, Event, log
  4. More data can be indexed by custom plugins
  5. Gen tool can automatically generate plugin templates
  6. Built-in default HTTP API DOC

QuickStart

Requirement

  • Linux / Mac OSX
  • Git
  • Golang 1.20+
  • Redis 3.0.4+
  • MySQL 5.6+
  • Node 8.9.0+

Install

./build.sh build

Config

Init config file

Init config file

cp configs/config.yaml.example configs/config.yaml

Set

  1. Redis configs/redis.toml

    addr: redis host and port (default: 127.0.0.1:6379)

  2. Mysql configs/mysql.toml

    host: mysql host (default: 127.0.0.1) user: mysql user (default: root) pass: mysql user passwd (default: "") db: mysql db name (default: "subscan")

  3. Http configs/http.toml

    addr: local http server port (default: 0.0.0.0:4399)

Usage

  • Start DB Make sure you have started redis and mysql

  • Substrate Daemon

    cd cmd
    ./subscan start substrate
  • Api Server

    cd cmd
    ./subscan
  • Help

  • Help

    NAME:
       SubScan - SubScan Backend Service, use -h get help
    
    USAGE:
       main [global options] command [command options] [arguments...]
    
    VERSION:
       1.0
    
    DESCRIPTION:
       SubScan Backend Service, substrate blockchain explorer
    
    COMMANDS:
       start    Start one worker, E.g substrate
       install  Create database and create default conf file
       help, h  Shows a list of commands or help for one command
    
    GLOBAL OPTIONS:
       --conf value   (default: "../configs")
       --help, -h     show help
       --version, -v  print the version
    
    
    

Docker

If you prefer running containers, you can use docker-compose.

Create local network

docker network create app_net

Run mysql and redis container

docker-compose -f docker-compose.db.yml up  -d

Run subscan service

docker-compose build
docker-compose up -d

Test

Note: The default test mysql database is subscan_test. Please CREATE it or change configs/mysql.toml.

go test ./...

Contributions

We welcome contributions of any kind. Issues labeled can be good (first) contributions.

LICENSE

GPL-3.0

Resource

Packages

No packages published

Languages

  • Go 99.7%
  • Other 0.3%