pdanalytics contains modules for exploring the decred blockchain and collecting additional info about the decred cryptocurrency like ticker and orderbook data from various exchanges. Each module can be enabled/disabled giving the user the ability to run a light-weight version of the program at will.
To run pdanalytics on your machine you will need the following to be setup.
Go1.13Postgresql(Optional, depending on the activated modules)Nodejs.Node.js is only used as a build tool, and is not used at runtimeDcrd(Optional, depending on the activated modules)
Install Go
- Minimum supported version is 1.13. Installation instructions can be found here.
Install Postgrsql
-
Postgrsql is a relational DBMS used for data storage. Download and installation guide can be found here
-
Quick start for Postgresql
If you have a new postgresql install and you want a quick setup for pdanalytics, you can start
postgresql command-line client(It comes with the installation) with...Linux
sudo -u postgres psqlor you couldsuinto the postgres user and runpsqlthen execute the sql statements below to create a user and database.
Windows
- Just open the command line interface and type
psqlthen execute the sql statements below to create a user and database.
CREATE USER {username} WITH PASSWORD '{password}' CREATEDB;
CREATE DATABASE {databasename} OWNER {username};Install Nodejs
- Instructions on how to install
Nodejscan be found here
Install Dcrd
- Running
dcrdsynchronized to the current best block on the network. - Download the decred release binaries for your operating system from here. Check under Assets.
- The binary contains other decred packages for connecting to the decred network.
- Extract dcrd Only, go here to learn how to setup and run decred binaries.
- Clone the pdanalytics repository. It is conventional to put it under
GOPATH, but this is no longer necessary with go module.
git clone https://github.com/planetdecred/pdanalytics- If you cloned to $GOPATH, set the
GO111MODULE=onenvironment variable before building. Runexport GO111MODULE=onin terminal (for Mac/Linux) orsetx GO111MODULE onin command prompt for Windows. cdto the cloned project directory and rungo buildorgo install. Building will place thepdanalyticsbinary in your working directory while install will place the binary in $GOPATH/bin.
- From your project directory,
cdinto thewebfolder and runnpm installwhen its done installing packages, runnpm run build.
pdanalytics can be configured via command-line options or a config file located in the home directory. Start with the sample config file:
cp sample-pdanalytics.conf ~/.pdanalytics/pdanalytics.confThen edit ~/.pdanalytics/pdanalytics.conf with your postgres settings. See the output of pdanalytics --help
for a list of all options and their default values.
To run pdanalytics, use...
pdanalyticson your command line interface to create database table, fetch data and store the data and launch the http web server. The web server can be disabled by setting--nohttp- You can perform a reset by running with the
-Ror--resetflag. - Run
pdanalytics -horpdanalytics helpto get general information of commands and options that can be issued on the cli. - Use
pdanalytics <command> -horpdanalytics help <command>to get detailed information about a command.
See the CONTRIBUTING.md file for details. Here's an overview:
- Fork this repo to your github account
- Before starting any work, ensure the master branch of your forked repo is even with this repo's master branch
- Create a branch for your work (
git checkout -b my-work master) - Write your codes
- Run the code linter
golangci-lint run --deadline=10m --disable-all \
--enable govet \
--enable staticcheck \
--enable gosimple \
--enable unconvert \
--enable ineffassign \
--enable goimports \
--enable misspell- Build and test your changes
go build -o pdanalytics -v -ldflags \
"-X github.com/planetdecred/pdanalytics/version.appPreRelease=beta \
-X github.com/planetdecred/pdanalytics/version.appBuild=`git rev-parse --short HEAD`"- Commit and push to the newly created branch on your forked repo
- Create a pull request from your new branch to this repo's master branch