@neotracker/core

1.4.1 • Public • Published

NEO Tracker

CircleCI PRs Welcome

NEO Tracker is a Neo blockchain explorer and wallet.

Contributing

Welcome to the NEO Tracker community! We're always looking for more contributors and are happy to have you. Documentation on how to contribute can be found here.

Environment Setup

The following instructions for how to setup your development environment for NEO Tracker are known to work on Mac, but should work on any Unix-like system.

Requirements

Start a NEO•ONE private network

NEO Tracker is best developed against a private network, which we can setup easily with NEO•ONE.

  • yarn install (install dependencies, including @neo-one/cli)
  • yarn neo-one start network (starts a private network)

By default, NEO•ONE will create a private network with the RPC url http://localhost:9040/rpc, but this can be configured in a NEO•ONE configuration file. Note for this purpose, only the network option is relevant.

Start NEO Tracker

  • yarn install (install dependencies)
  • yarn develop (starts a watched instance of NEO Tracker for development)

By default, yarn develop sets up a SQLite database in the neotracker root directory. If you'd prefer to work with Postgres 10.3, this and other options can be configured in a .neotrackerrc file. See below for the full list of configurable options.

Setup Postgres

If you'd like to use Postgres 10.3, here are some instructions for getting started.

We will use the $PGDATA environment variable in the following examples. You may set this variable with export PGDATA=<directory to store database> if it's not set. For example, on macOS you can use the default data directory with export PGDATA=/usr/local/var/postgres. To make this a "permanent" environment variable, for use in other sessions, you'll want to add export PGDATA="/usr/local/var/postgres" to your .bashrc or .zshrc file(s).

  • initdb $PGDATA (initialize the data directory)
  • pg_ctl -D $PGDATA start (start postgres)
  • createdb neotracker_priv (create the database for NEO Tracker)

To connect this database with neotracker, in the .neotrackerrc file, set dbClient to pg and dbPort to the port the postgres server was started on (defaults to 5432).

General Tips

  • To reset the local database, simply run yarn develop --resetDB.

Options

The full list of configurable options in the .neotrackerrc file. These can be added to the file or passed in as cli arguments.

{
  "type": "all", // Components to run: "all" | "scrape" | "web"
  "port": 1340, // Port the website will be on
  "network": "priv", // Neo network to run on
  "ci": false, // Running as part of continuous integration
  "prod": false, // Compile for production
  "nodeRpcUrl": "http://localhost:9040/rpc", // NEO•ONE Node RPC URL
  "db": {
    "client": "sqlite3", // Database Client - "sqlite3" or "pg"
    "connection": { // Database Connection Configuration (see below for postgres example)
      "filename": "db.sqlite" // local sqlite database filename
    }
  },
  "resetDB": false, // Resets database
  "logLevel": "info", // Sets pino log level globally: "trace" | "debug" | "info" | "warn" | "error" | "fatal" | "silent"
  "apiKeys": {
    "coinMarketCap": "", // API key needed to get current price data from CoinMarketCap. You must supply your own key to make this feature work
    "googleAnalyticsTag": "", // Google Analytics Tag
  }
}

with a postgres db we have two connection options, a connection string or connection object.

connection string configuration:

{
  "db": {
    "client": "pg",
    "connection": "postgresql://localhost:5432/neotracker_priv"
  }
}

connection object configuration:

{
  "db": {
    "client": "pg",
    "connection": {
      "host": "localhost",
      "port": 5433,
      "user": "admin" // optional username
      "password": "password" // optional password
      "database": "neotracker_priv" // optional database name
    }
  }
}

License

NEO Tracker is MIT licensed.

Readme

Keywords

Package Sidebar

Install

npm i @neotracker/core

Weekly Downloads

3

Version

1.4.1

License

MIT

Unpacked Size

33.2 MB

Total Files

79

Last publish

Collaborators

  • afragapane
  • dicarlo
  • spencercorwin