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.
Go
1.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 psql
or you couldsu
into the postgres user and runpsql
then execute the sql statements below to create a user and database.
Windows
- Just open the command line interface and type
psql
then 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
Nodejs
can be found here
Install Dcrd
- Running
dcrd
synchronized 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=on
environment variable before building. Runexport GO111MODULE=on
in terminal (for Mac/Linux) orsetx GO111MODULE on
in command prompt for Windows. cd
to the cloned project directory and rungo build
orgo install
. Building will place thepdanalytics
binary in your working directory while install will place the binary in $GOPATH/bin.
- From your project directory,
cd
into theweb
folder and runnpm install
when 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.conf
Then 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...
pdanalytics
on 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
-R
or--reset
flag. - Run
pdanalytics -h
orpdanalytics help
to get general information of commands and options that can be issued on the cli. - Use
pdanalytics <command> -h
orpdanalytics 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