Skip to content

Latest commit

 

History

History
136 lines (112 loc) · 4.95 KB

README.md

File metadata and controls

136 lines (112 loc) · 4.95 KB
Provenance Explorer Service


Provenance Explorer

The purpose of this api backend is to provide a single API for the Provenance Blockchain Explorer frontend, aggregate and cache information needed by the front end (e.g. simplify multiple block/transaction calls into a single call), and provide Provenance Blockchain specific endpoints.

Status

Latest Release Apache 2.0 License LOC Lint Status

Table of Contents

How to run testnet and explorer locally

Necessary tools

  • Git
  • GO lang
    • comes with Make
  • LevelDB
  • NPM
  • Docker
  • Docker-compose

To get testnet up

To start a local isolated cluster

  • Run make clean ; make build; make localnet-start
    • This allows you to stand up 4 nodes in a local cluster

  • If you want to enable the swagger
    • go to build/node0/config/app.toml
    • edit the file at
      # Swagger defines if swagger documentation should automatically be registered.
      swagger = false <- set to true
      
    • run make localnet-start

  • To stop the cluster, run make localnet-stop

To start a node on the public chain

  • Run git fetch --all; git checkout {tag_you_want}; make clean install;
  • TODO: Fill in the rest

To get Explorer up

Manually - in terminals

To get the explorer database up FIRST
  • Run ./scripts/dc.sh up
    • To get an existing database up again, run ./scripts/dc.sh up-cached
To get the explorer API up SECOND
  • Go to service/src/main/resources/application.properties
  • Make sure the following properties are as follows:
    explorer.mainnet=false
    explorer.pb-url=http://localhost:9090
    
  • Run from command line
    sh ./gradlew -------------> Installs the gradlew stuff
    ./gradlew clean
    ./gradlew build
    ./gradlew bootRun -Dspring.profiles.active=development
    
To get the explorer UI up THIRD

Via Docker and Docker-compose

  • Run docker-compose -f docker/docker-compose.yml up
  • This stands up dockers for database, service and frontend.

Swagger URLs

Useful to hit the respective APIs directly

Swagger for Explorer : http://localhost:8612/swagger-ui/index.html
Swagger for Testnet: http://localhost:1317/swagger/

Linting

We use Ktlint for our linting use -> https://pinterest.github.io/ktlint/rules/standard/ Currently on version 0.47.1

To install the Kotlin linter run:

brew install ktlint

In order to automatically lint/check for things that can't be autocorrected run:

ktlint -F "**/*.kt" --disabled_rules=filename,chain-wrapping,enum-entry-name-case,multiline-if-else

This will also correct linting issues, and you can add and commit the updates.

There is a GHA that checks for linting issues, and produces a report on the associated PR.