Skip to content

Commit

Permalink
Merge pull request #74 from ZencashOfficial/dev2
Browse files Browse the repository at this point in the history
Dev2 to 0.3.1
  • Loading branch information
ADumaine authored Jul 18, 2018
2 parents ef50173 + bb6d93e commit 962200d
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 537 deletions.
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
# nodetracker
#### ZenCash Secure And Super Node tracking app

This 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 zencash 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

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

Super Node
- a stake address with at least 500 ZEN
- be able to perform challenges in 150 seconds or
- be able to perform challenges in 150 seconds or under
- 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.

## Version 0.3.0
This version is also used for Super Nodes. A selection is made during the setup for the type of node.
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.
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.

#### 0.3.1
- added zen.conf requirements for externalip and port.
- fixed maintaining nodeid on setup rerun



### 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://documentation.zencash.com/display/ZEN/Installation)
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)

#### Check the version of nodejs
1. Run the following command
Expand Down Expand Up @@ -63,8 +70,14 @@ These are update instructions. If you are doing a new install see the New Insta
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

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

* Ctrl-c
* node app
Expand All @@ -74,7 +87,7 @@ These are update instructions. If you are doing a new install see the New Insta


## NEW INSTALLATION
If you have followed [Installation Guide](https://documentation.zencash.com/display/ZEN/Installation) for creating a Secure or Super Node, you should be ready to install this on your node.
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.

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 Down Expand Up @@ -119,10 +132,11 @@ You will need your staking address (with at least 42 ZEN for secure or 500 ZEN f
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


### Start the tracking app
Once setup is complete, start the tracker manually or with your system configuration or nodejs process monitor such as PM2.
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

Expand All @@ -133,8 +147,8 @@ Use Ctrl-c to break out of the app.

### 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.
Secure Nodes - https://securenodes.zensystem.io
Super Nodes - https://superenodes.zensystem.io
* 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)
Expand All @@ -144,6 +158,8 @@ For community support, ask questions in the ZenCash Discord #securenodes channel

Instructions on installing a monitoring tool like nodemon or PM2 may be found separately.



**Locating zen.conf**
There are two optional environment variables that may be used to locate zen.conf which is needed for rpc configuration.

Expand Down
28 changes: 3 additions & 25 deletions SNodeTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ const rpcError = (err, txt, cb) => {


class SNode {
constructor(rpc) {
constructor(rpc, cfgzen) {
this.rpc = rpc;
this.zencfg = cfgzen;
this.statsInterval = 1000 * 60 * 6;
this.statsTimer = null;
this.statsLoop = () => {
Expand Down Expand Up @@ -77,7 +78,7 @@ class SNode {

static auto() {
const rpc = new StdRPC(cfg);
return new SNode(rpc);
return new SNode(rpc, zencfg);
}

initialize() {
Expand Down Expand Up @@ -168,22 +169,7 @@ class SNode {
self.rpc.getblockhash(chal.blocknum)
.then((hash) => {
self.queueCount = 0;
/*
if (hash.error) {
const resp = { crid: chal.crid, status: 'failed', error: 'unable to get blockhash from zen' };
self.chalRunning = false;
resp.ident = self.ident;
self.socket.emit('chalresp', resp);
console.log(logtime(), `ERROR: challenge unable to get blockhash for challenge id ${chal.crid} block ${chal.blocknum}`);
console.error(logtime(), hash.error);
if (!self.zenDownTimer) {
self.zenDownTimer = setInterval(self.zenDownLoop, self.zenDownInterval);
}
return;
}
*/
if (self.zenDownTimer) clearInterval(self.zenDownTimer);

self.rpc.getblock(hash)
.then((block) => {
const msgBuff = new Buffer.from(block.merkleroot);
Expand Down Expand Up @@ -325,14 +311,6 @@ class SNode {
}
}
})
/*
.catch((err) => {
self.chalRunning = false;
console.log(logtime(), 'ERROR Challenge: could not get operation status.');
console.error(logtime(), err.message, err.response.data);
clearInterval(self.opTimer);
});
*/
.catch(err => rpcError(err, 'get operation status', (errmsg, errtype) => {
if (errtype && errtype === 'queue') {
console.log(logtime(), 'ERROR: challenge - waiting for room in work queue');
Expand Down
Loading

0 comments on commit 962200d

Please sign in to comment.