Giter Club home page Giter Club logo

subscan's Introduction

grants_badge

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. 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 index Block, Extrinsic, Event, log
  3. More data can be indexed by custom plugins
  4. Gen tool can automatically generate plugin templates
  5. Built-in default HTTP API DOC

QuickStart

Requirement

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

Install

./build.sh build

//UI
cd ui && yarn && yarn dev

UI

The ui part is built with nuxt.js and amis

Demo: blocks, refer to amis docs for further detail.

Online Demo

Please change proxy target in nuxt.config.js to your server name in development.

proxy: {
   "/api": {
      target: "https://your_server_name.com",
      secure: false,
      changeOrigin: true,
      pathRewrite: {
         "^/api": "/api"
      }
   },
}

Please change browserBaseURL in nuxt.config.js to your server name in production.

axios: {
   proxy: process.env.NODE_ENV !== 'production',
    browserBaseURL: process.env.NODE_ENV !== 'production' ? "" : "https://your_server_name.com"
},

Example

ui_demo

First choose a search type, and enter search content. Then click search button, result will be shown in the output section.

Feature Supported

  • search block detail by block number or block hash
  • search extrinsic detail by extrinsic index or extrinsic hash
  • search runtime info by spec version
  • plugin (blocks, events)

Config

Init config file

cp configs/redis.toml.example configs/redis.toml && cp configs/mysql.toml.example configs/mysql.toml && cp configs/http.toml.example configs/http.toml

Set

  1. Redis configs/redis.toml

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

  1. 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")

  1. 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
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
     stop     Stop 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

Use docker-compose can start projects quickly

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

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

go test ./...

//UI
cd ui && yarn && yarn test

Contributions

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

LICENSE

GPL-3.0

Resource

subscan's People

Contributors

jackygu2006 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.