Skip to content

Commit

Permalink
Merge pull request #89 from ZencashOfficial/development_rc1
Browse files Browse the repository at this point in the history
Nodetracker 0.4.0
  • Loading branch information
cronicc authored Feb 6, 2019
2 parents 962200d + 7d8de60 commit 85d00f1
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 155 deletions.
114 changes: 59 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
# nodetracker
#### ZenCash Secure And Super Node tracking app
#### Horizen Secure And Super Node tracking app

This application is installed on a Secure Node or a Super Node to allow it to communicate with its corresponding zensystem.io tracking server. It provides data to the server about the node and performs compliance challenges. Nodes that are in compliance receive a percentage of the block rewards. The tracking networks runs completely separate from the zencash network.
This application is installed on a Secure Node or a Super Node to allow it to communicate with its corresponding zensystem.io tracking server. It provides data to the server about the node and performs compliance challenges. Nodes that are in compliance receive a percentage of the block rewards. The tracking networks runs completely separate from the horizen network.

Each nodetracker must have
- a unique IP address (v4 or v6) also used by zend
- about 0.04 ZEN for challenges in one or more z-address on the node
- about 0.01 ZEN for challenges in one or more z-address on the node

Secure Node
- maintain a stake address with at least 42 ZEN
- be able to perform challenges in 300 seconds or under
- be able to perform challenges in 300 seconds or under (or as posted)
- uptime of 92% or greater

Super Node
- a stake address with at least 500 ZEN
- be able to perform challenges in 150 seconds or under
- be able to perform challenges in 150 seconds or under (or as posted)
- uptime of 96% or greater
- zend configured with both IPv4 and IPv6 addresses

See the [Secure Node About page](https://securenodes.zensystem.io/) or [Super Node About page](https://supernodes.zensystem.io/) on the tracking servers for full details about compliance.

See the [Installation Guide](https://zencash.atlassian.net/wiki/spaces/ZEN/pages/7537322/Installation) for detailed configuration steps.

## Version 0.3.x
Version 0.3+ is required for Super Nodes. A selection is made during the setup for the type of node.

Along with some additional logging and formatting, this version also replaces the bitcoin-core and zcash node modules with a stdrpc module for communication with zend.

This version will check the zen configuration file to see if it is running on [testnet](https://securenodes.testnet.zensystem.io/) during the setup process. There is no longer a need to edit the init.json file.
See the [Installation Guide](https://horizenofficial.atlassian.net/wiki/spaces/ZEN/pages/136872139/Installation) for detailed configuration steps.

## Changes

#### 0.4.0
- Randomize delay before reconnect
- Remove socket reinit on reconnect
- Add drop socket and connect on server request
- Include region in move home
- Remove tls peers on stats check
- Add tls peers on server request
- Add stat acknowledgment random timeouts before reset socket
- Add save application settings to local update from tracking server
- Add multiple zaddr check to use highest balance
- Add latency check based on socket level ping/pong
- Add periodic ‘checkIn’ (ping/pong) at application level
- Add error check and retry timer on failure to get zaddress balance
- Save application settings to local and allow updates from server
- Add ipv6 lookup family to ipv6 dns workaround (credit to emminer - thanks!)
- Challenge: low balance no longer creates Exception. Fails on no funds.
- Current server saved to config/local for external scripts

#### 0.3.1
- added zen.conf requirements for externalip and port.
Expand All @@ -36,24 +49,25 @@ This version will check the zen configuration file to see if it is running on [t


### UPDATE STEPS:
These are update instructions. If you are doing a new install see the New Installation instructions further down or in the online [Installation Guide](https://zencash.atlassian.net/wiki/spaces/ZEN/pages/7537322/Installation)
These are general update instructions. For full instructions please use the [Maintenance Guide](https://horizenofficial.atlassian.net/wiki/spaces/ZEN/pages/136871983/Maintenance)

If you are doing a new install the general New Installation instructions further down can be used but the best option is to use the online [Installation Guide](https://horizenofficial.atlassian.net/wiki/spaces/ZEN/pages/136872139/Installation)

#### Check the version of nodejs
1. Run the following command
* node -v

- Suggested version is 8.11.x since it will have long term support. Node.js versions greater than this have not been tested but should work.
- Suggested version is 10.x.x since it will have long term support. Node.js versions greater than this have not been tested but may work.

To update or change run:
* sudo n lts

#### Update nodetracker
NOTE: for backward compatibility the folder remains 'secnodetracker' even for Super Nodes.
NOTE: for backward compatibility the folder can be named 'secnodetracker' even for Super Nodes. However if you would like to change the folder please see the upgrade section in the installation guide

1. Change to the secnodetracker folder and update the tracker application.
This may be '~/zencash/secnodetracker' if the install guides were followed.
1. Change to the nodetracker folder and update the tracker application. This may be 'zencash/secnodetracker' if the old install guides were followed.

* cd ~/zencash/secnodetracker
* cd ~/nodetracker
* git fetch origin
* git checkout master
* git pull
Expand All @@ -62,32 +76,22 @@ These are update instructions. If you are doing a new install see the New Insta
e.g. git checkout -- package.json
Then run the last 3 above commands again.

2. Add node.js environment variable when updating the npm modules.This will stop the next step from installing development libraries. Install new nodejs module and remove old ones.

* NODE_ENV=production npm install
2. Install/update new nodejs modules and remove old ones. Use a node.js environment variable when updating the npm modules. This will stop npm from installing development libraries.

3. Run setup (this will refresh the list of servers) in the tracker's config folder.
You should be able to accept all the previous values. There are two new propmts: the node type (secure or super) and an optional category. The category can be used to help filter your nodes (if you have many) in certain API calls.

* node setup
Update the zen.conf file and rerun setup until it completes successfully

4. Stop and restart zend
Manually: zen-cli stop && sleep 10 && zend
or
Use the you usually use like pm2 or systemd
* NODE_ENV=production npm install

5. Stop the tracker application and restart it
3. Stop the tracker application and restart it

* Ctrl-c
* node app
* or restart using your management application such as PM2
* or restart using your management application such as PM2 or systemd




## NEW INSTALLATION
If you have followed [Installation Guide](https://zencash.atlassian.net/wiki/spaces/ZEN/pages/7537322/Installation) for creating a Secure or Super Node, you should be ready to install this on your node.
It is suggested you follow the much more detailed [Installation Guide](https://horizenofficial.atlassian.net/wiki/spaces/ZEN/pages/136872139/Installation) for creating a Secure or Super Node. The instructions below are general instructions for the nodetracker.

You will need about 0.04 zen in the node's wallet in a private address. Send multiple small amounts (0.01 each) to work around an issue with 0 balances due to waiting for change to return after a challenge. Alternately create an additional private z-address and split the amount between them.

Expand All @@ -102,61 +106,65 @@ These instructions should be run as the user created in the guide (not root).
### Install npm and Node.js
Log into your node computer or vps. The following commands install Node.js (a javascript virtual machine) and NPM (Node Package Manager)

- Suggested version is 8.11.x since it will have long term support. Node.js versions greater than this have not been tested but should work.
- Suggested version is 10.13.x (or higher 10.x) since it will have long term support. Node.js versions greater than this have not been tested but should work.

* sudo apt-get install npm
* sudo npm install -g n
* sudo n lts

### Clone this repository
If you followed the Guides you should have a ~/zencash folder with the zen folder in it.
Put this repository in the zencash folder too or the folder of your choice.
Note: if you would like to name the folder during the clone process, append the folder name to the clone command. The default is 'secnodetracker'.

* cd ~/zencash
* git clone https://github.com/ZencashOfficial/secnodetracker.git
Note: if you would like to name the folder during the clone process, append the folder name to the clone command. The default is 'nodetracker'.

* cd ~/
* git clone https://github.com/ZencashOfficial/nodetracker.git

or to specify a folder name
git clone https://github.com/ZencashOfficial/secnodetracker.git nodetracker
git clone https://github.com/ZencashOfficial/nodetracker.git nodetracker


### Install the nodejs modules
Use the environment variable to keep from installing development libraries. If a different folder was specified substitute its name

* cd secnodetracker
* cd nodetracker
* NODE_ENV=production npm install

### Run setup
You will need your staking address (with at least 42 ZEN for secure or 500 ZEN for super) and an email address for alerts (if you do not want alerts enter 'none' for the email address or leave it blank). During setup press Enter to accept the default or enter new information when prompted. See the Note below on finding the zen.conf file if is is not in its standard location.
You will need your staking address (with at least 42 ZEN for Secure Nodes or 500 ZEN for Super Nodes) and an email address for alerts (if you do not want alerts enter 'none' for the email address or leave it blank. NOTE: an email address is required for all the 'My' pages on the tracking server and the API).

During setup press Enter to accept the default and enter new information when prompted. See the Note below on finding the zen.conf file if it is not in its standard location.

There is a prompt for an optional category. This allows a node operator with multiple nodes to group them together.

* node setup
Update the zen.conf file and rerun setup until it completes successfully

NOTE: The setup process will stop if zen.conf does not have certain entries. Update the zen.conf file and rerun setup until it completes successfully.


### Start the tracking app
Before starting the nodetracker make sure the blockchain is fully synced and the stake address has the correct confirmed amount.

Once setup is complete, start the tracker manually or with your system configuration or nodejs process monitor such as PM2 or if you have it configured to use systemd.

* node app

Follow any instructions shown on the console. Rerun setup if needed: it will remember your previous values.
Use Ctrl-c to break out of the app.
Use Ctrl-c to break out of the app if running directly in nodejs.

**NOTE:** There should only be 1 instance of the tracking app running at a time. It is also best to wait to start the tracker until the blockchain is fully synced.
**NOTE:** There should only be 1 instance of the tracking app running at a time.

### Check the node on the Tracking Server
Check your node on one of the tracking servers using the Nodes>All Nodes page or the Nodes>My Nodes page.
Check your node on one of the tracking servers using the 'Nodes>All Nodes' page or the 'Nodes>My Nodes' page (after generating an API key).
* Secure Nodes - https://securenodes.zensystem.io
* Super Nodes - https://supernodes.zensystem.io


For any issues or help with a node, submit a ticket to [Support](https://support.zencash.com)
For any issues or help with a node, submit a ticket to [Support](https://support.horizen.global)

For community support, ask questions in the ZenCash Discord #securenodes channel.
For community support, ask questions in the Horizen Discord [#node_tech_support](https://discordapp.com/invite/Hu5mQxR) channel.


Instructions on installing a monitoring tool like nodemon or PM2 may be found separately.
Instructions on installing a monitoring tool like nodemon or PM2 may be found separately. The suggested monitoring method is in the Installation Guide



Expand All @@ -172,8 +180,4 @@ There are two optional environment variables that may be used to locate zen.conf
- oshome + "/.zen/zen.conf";
- oshome + "/zencash/.zen/zen.conf";
- oshome + "/AppData/Roaming/Zen/zen.conf";






Loading

0 comments on commit 85d00f1

Please sign in to comment.