Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Add ZCL testnet, BTCP, BTCP testnet initial values #270

Open
wants to merge 86 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
14c83bc
Add ZCL testnet, BTCP, BTCP testnet initial values
Jan 16, 2018
87beba9
Updated stats page for equihash pool, initially
Jan 19, 2018
0de7c10
Added workers section, Black and white
Jan 22, 2018
f988cb8
Bring over the poolstats too
Jan 22, 2018
08b04ef
Site rework ft Otis - Vicious theme
ch4ot1c Jan 23, 2018
d899338
updates to ui
ch4ot1c Jan 23, 2018
9115a1d
updates to ui
ch4ot1c Jan 23, 2018
b0761a7
ToS prompt
ch4ot1c Jan 23, 2018
9b8ee93
Remove dump.rdb and add to gitignore
ch4ot1c Jan 23, 2018
7ffa87b
Patch fix
ch4ot1c Jan 23, 2018
9e07d5a
ToS Modal
ch4ot1c Jan 23, 2018
5e4d1c7
Cannot click thru ToS anymore
ch4ot1c Jan 24, 2018
0ee99b5
Small card header changes
ch4ot1c Jan 24, 2018
6bc8f5b
Small card margin changes
ch4ot1c Jan 24, 2018
e3fe6ee
BTCP image + other
ch4ot1c Jan 24, 2018
36c2566
Initial work on saving tos
ch4ot1c Jan 24, 2018
6a98fb5
Fill in httpController method
ch4ot1c Jan 24, 2018
4ce48e9
Express with level on port 3000, db file in gitignore
ch4ot1c Jan 24, 2018
3e04f74
fixed xss by using built-in doT html encoding
rzwck Jan 24, 2018
bc6b794
Syntax, pagestart check
ch4ot1c Jan 24, 2018
f45ff4b
Merge pull request #2 from ch4ot1c/tos
interbiznw Jan 24, 2018
fb8d332
Port 8000, /entry, jsonp removed for normal http post
ch4ot1c Jan 24, 2018
9b29036
CORS issue fixed, req.body still nil after body-parser
ch4ot1c Jan 24, 2018
a16c874
Express server replies properly
ch4ot1c Jan 24, 2018
0d6be51
Works up and back, now just must dismiss
ch4ot1c Jan 24, 2018
5447615
Final logging + dismissal tweaks
ch4ot1c Jan 24, 2018
f309fe1
Merge pull request #3 from ch4ot1c/tos
interbiznw Jan 24, 2018
d7e72bb
Merge pull request #1 from rizkiwicaksono/fix-xss-vuln-workers-address
ch4ot1c Jan 24, 2018
60d09e9
HTTP + HTTPS 8000 8443, HTTP runs fine
ch4ot1c Jan 24, 2018
256f894
Https?
ch4ot1c Jan 24, 2018
4e7d015
Merge pull request #4 from ch4ot1c/tos
interbiznw Jan 24, 2018
b64e6d5
Updates from 1-23-18 and 24
ch4ot1c Jan 24, 2018
bee8dda
CoinInfoRow length
ch4ot1c Jan 24, 2018
aaebbd3
Merge pull request #5 from ch4ot1c/tos
interbiznw Jan 24, 2018
5bebb74
Add sslcert to gitignore
ch4ot1c Jan 24, 2018
20546cc
Remove sslcert folder
ch4ot1c Jan 24, 2018
eb5639e
Merge remote-tracking branch 'origin/tos' into HEAD
Jan 24, 2018
6eb0f25
xss issue - sanitized workers url
Jan 25, 2018
18c4272
Update gitignore
interbiznw Jan 25, 2018
11bd53d
xss url fixes
interbiznw Jan 25, 2018
293c785
ZCL Donation Pool - initial release
interbiznw Jan 26, 2018
8171340
Estimated days until completion
ch4ot1c Jan 26, 2018
fde455a
fixed port, needs to be 8000 on dev and 8443 on prod
interbiznw Jan 26, 2018
07becd3
Merge branch 'pool-release'
Jan 26, 2018
721b009
changed explorer link for block stats and pushed paymentProcessor cha…
interbiznw Jan 27, 2018
f4013fc
Consistent indentation of page html
Jan 27, 2018
3149bcf
npm start was failing, tbs + unclosed tags was the culprit
Jan 27, 2018
932284e
Close more unclosed tags
Jan 27, 2018
1711f01
added faq, added info alert to site and stats pages
interbiznw Jan 27, 2018
6540ab7
Mining Software info fixes, more orange, layout fixes
Jan 27, 2018
eb177c8
API layout, last txt blues to black, donation addr improvement
Jan 27, 2018
1ebbbbc
Merge branch 'master' into pool-release
interbiznw Jan 28, 2018
caa43e5
Merge pull request #8 from BTCP-community/pool-release
interbiznw Jan 28, 2018
7dbb858
removed alert about pending funds not showing
interbiznw Jan 29, 2018
2fb989d
updated alert/info message to miners
interbiznw Jan 29, 2018
8eeddf4
Fixed css floating 'to top' button was covering next page buttons
interbiznw Jan 29, 2018
90dd532
Updated code to calculate stats correctly
interbiznw Jan 29, 2018
2a4e47f
final miner stats updates and alert/info messages
interbiznw Jan 30, 2018
067515d
updated stats
interbiznw Jan 30, 2018
3da43b4
Fix indentation on html pages
Jan 31, 2018
f97c29c
Remove models.js, more indentation
Jan 31, 2018
e77e69e
Removed breadcrumbs, typography styles, miner address search to zcl c…
Feb 1, 2018
9ed4f86
recent updates
Feb 1, 2018
d5447ce
Improve FAQ and getting started ux
Feb 1, 2018
704549f
fixed miner stats live stats update rate that was hammering API
Feb 1, 2018
0866e0f
reduced stats polling and fixed zcl stats issue with only showing las…
interbiznw Feb 1, 2018
2bdc802
Merge pull request #1 from BTCP-community/master
rzwck Feb 2, 2018
dbc38c3
Merge branch 'master' into ux
interbiznw Feb 2, 2018
337f0ea
Merge pull request #7 from ch4ot1c/ux
interbiznw Feb 2, 2018
7f7f88f
Homepage Donation progess bar correction
nsuva Feb 2, 2018
3f80d5c
Merge branch 'production' into prod
Feb 2, 2018
235d413
Improve FAQ and getting started ux
Feb 1, 2018
8cf2341
updated alert msg and stats to reduce live stats data
Feb 2, 2018
02ebda9
FAQ and Getting Started addition, grammar, styling remaining oranges,…
Feb 2, 2018
bb21d98
Remove final breadcrumbs, spacing on workers page
Feb 2, 2018
4688800
Merge pull request #10 from nsuva/patch-1
interbiznw Feb 7, 2018
9480165
Merge branch 'master' into prod
interbiznw Feb 7, 2018
bc62f37
Merge pull request #12 from BTCP-community/prod
interbiznw Feb 7, 2018
1281243
updates to javascript api to reduce egress data to each miner, was ca…
Feb 7, 2018
fa45706
Merge branch 'master' into production
interbiznw Feb 7, 2018
f0f1c29
Merge pull request #13 from BTCP-community/production
interbiznw Feb 7, 2018
afe7bf9
Update README.md
interbiznw Feb 7, 2018
ffa8f49
Update README.md
interbiznw Feb 7, 2018
42ce642
enable cache for 1day
rzwck Feb 16, 2018
38884de
Merge pull request #16 from rizkiwicaksono/enable-static-files-cache
interbiznw Feb 17, 2018
f8ff948
Merge pull request #3 from BTCP-community/master
ch4ot1c Feb 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ node_modules/
config.json
pool_configs/*.json
!pool_configs/zclassic_example.json
dump.rdb
masf-entries-db
*.crt
*.key
*.rdb
*.bak
*.save
*.testnet
*.pem
traffic.txt
161 changes: 2 additions & 159 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,164 +1,7 @@
# Zcash® and Zclassic - Node Open Mining Portal

**[Click here for the official - Zcash® and Zclassic Stratum Mining Pool Installation Guide](https://zdeveloper.org/wiki:z-nomp_install)**

This is a Equihash mining pool based off of Node Open Mining Portal.

Donations for development are greatly appreciated!
* BTC: 18vHMxVzotQ9EPyESrf7Z1hNM9AwJeVHgD
* ZCL: zcXDWbgReztLLXSTUMT2nEumiDM6zTzUXFb7vUnx9JNfJDVqbodyxwEQwgDkFw7Dp128tBU8n8rmVxT43DshmeTEM4LHcdz
# Zclassic Donation Pool - Node Open Mining Portal

#### Production Usage Notice
This is beta software. All of the following are things that can change and break an existing Z-NOMP setup: functionality of any feature, structure of configuration files and structure of redis data. If you use this software in production then *DO NOT* pull new code straight into production usage because it can and often will break your setup and require you to tweak things like config files or redis data. *Only tagged releases are considered stable.*

#### Paid Solution
Usage of this software requires abilities with sysadmin, database admin, coin daemons, and sometimes a bit of programming. Running a production pool can literally be more work than a full-time job.


### Community / Support
IRC
* Support / general discussion join: https://gitter.im/zclassicorg/z-nomp

If your pool uses Z-NOMP let us know and we will list your website here.

### Some pools using Z-NOMP or node-stratum-module:

https://pool.cryptobroker.io/zcl Running MPOS and 0.5% of the fee goes to the Zclassic donation fund! 200+ blocks have been found as well!

http://luckpool.org Zcash Pool with Custom Frontend w/Miner's Jackpot

http://zclmine.com/ Custom frontend

http://zclassic.miningspeed.com Custom frontend and 0% fee

https://zpool.it 0.5% fee

http://miningpool.io/

Usage
=====


#### Requirements
* Coin daemon(s) (find the coin's repo and build latest version from source)
* [Node.js](http://nodejs.org/) v7+ ([follow these installation instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager))
* [Redis](http://redis.io/) key-value store v2.6+ ([follow these instructions](http://redis.io/topics/quickstart))

##### Seriously
Those are legitimate requirements. If you use old versions of Node.js or Redis that may come with your system package manager then you will have problems. Follow the linked instructions to get the last stable versions.


[**Redis security warning**](http://redis.io/topics/security): be sure firewall access to redis - an easy way is to
include `bind 127.0.0.1` in your `redis.conf` file. Also it's a good idea to learn about and understand software that
you are using - a good place to start with redis is [data persistence](http://redis.io/topics/persistence).


#### 0) Setting up coin daemon
Follow the build/install instructions for your coin daemon. Your coin.conf file should end up looking something like this:
```
daemon=1
rpcuser=zclassicrpc
rpcpassword=securepassword
rpcport=8232
```
For redundancy, its recommended to have at least two daemon instances running in case one drops out-of-sync or offline,
all instances will be polled for block/transaction updates and be used for submitting blocks. Creating a backup daemon
involves spawning a daemon using the `-datadir=/backup` command-line argument which creates a new daemon instance with
it's own config directory and coin.conf file. Learn about the daemon, how to use it and how it works if you want to be
a good pool operator. For starters be sure to read:
* https://en.bitcoin.it/wiki/Running_bitcoind
* https://en.bitcoin.it/wiki/Data_directory
* https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
* https://en.bitcoin.it/wiki/Difficulty


#### 1) Downloading & Installing

Clone the repository and run `npm update` for all the dependencies to be installed:

```bash
sudo apt-get install build-essential libsodium-dev npm
sudo npm install n -g
sudo n stable
git clone https://github.com/joshuayabut/node-open-mining-portal.git z-nomp
cd z-nomp
npm update
npm install
```

##### Pool config
Take a look at the example json file inside the `pool_configs` directory. Rename it to `zclassic.json` and change the
example fields to fit your setup.

```
Please Note that: 1 Difficulty is actually 8192, 0.125 Difficulty is actually 1024.

Whenever a miner submits a share, the pool counts the difficulty and keeps adding them as the shares.

ie: Miner 1 mines at 0.1 difficulty and finds 10 shares, the pool sees it as 1 share. Miner 2 mines at 0.5 difficulty and finds 5 shares, the pool sees it as 2.5 shares.
```


##### [Optional, recommended] Setting up blocknotify
1. In `config.json` set the port and password for `blockNotifyListener`
2. In your daemon conf file set the `blocknotify` command to use:
```
node [path to cli.js] [coin name in config] [block hash symbol]
```
Example: inside `zclassic.conf` add the line
```
blocknotify=node /home/user/z-nomp/scripts/cli.js blocknotify zclassic %s
```

Alternatively, you can use a more efficient block notify script written in pure C. Build and usage instructions
are commented in [scripts/blocknotify.c](scripts/blocknotify.c).


#### 3) Start the portal

```bash
npm start
```

###### Optional enhancements for your awesome new mining pool server setup:
* Use something like [forever](https://github.com/nodejitsu/forever) to keep the node script running
in case the master process crashes.
* Use something like [redis-commander](https://github.com/joeferner/redis-commander) to have a nice GUI
for exploring your redis database.
* Use something like [logrotator](http://www.thegeekstuff.com/2010/07/logrotate-examples/) to rotate log
output from Z-NOMP.
* Use [New Relic](http://newrelic.com/) to monitor your Z-NOMP instance and server performance.


#### Upgrading Z-NOMP
When updating Z-NOMP to the latest code its important to not only `git pull` the latest from this repo, but to also update
the `node-stratum-pool` and `node-multi-hashing` modules, and any config files that may have been changed.
* Inside your Z-NOMP directory (where the init.js script is) do `git pull` to get the latest Z-NOMP code.
* Remove the dependenices by deleting the `node_modules` directory with `rm -r node_modules`.
* Run `npm update` to force updating/reinstalling of the dependencies.
* Compare your `config.json` and `pool_configs/coin.json` configurations to the latest example ones in this repo or the ones in the setup instructions where each config field is explained. <b>You may need to modify or add any new changes.</b>


Credits
-------
### Z-NOMP
* [Joshua Yabut / movrcx](https://github.com/joshuayabut)
* [Aayan L / anarch3](https://github.com/aayanl)
* [hellcatz](https://github.com/hellcatz)

### NOMP
* [Matthew Little / zone117x](https://github.com/zone117x) - developer of NOMP
* [Jerry Brady / mintyfresh68](https://github.com/bluecircle) - got coin-switching fully working and developed proxy-per-algo feature
* [Tony Dobbs](http://anthonydobbs.com) - designs for front-end and created the NOMP logo
* [LucasJones](//github.com/LucasJones) - got p2p block notify working and implemented additional hashing algos
* [vekexasia](//github.com/vekexasia) - co-developer & great tester
* [TheSeven](//github.com/TheSeven) - answering an absurd amount of my questions and being a very helpful gentleman
* [UdjinM6](//github.com/UdjinM6) - helped implement fee withdrawal in payment processing
* [Alex Petrov / sysmanalex](https://github.com/sysmanalex) - contributed the pure C block notify script
* [svirusxxx](//github.com/svirusxxx) - sponsored development of MPOS mode
* [icecube45](//github.com/icecube45) - helping out with the repo wiki
* [Fcases](//github.com/Fcases) - ordered me a pizza <3
* Those that contributed to [node-stratum-pool](//github.com/zone117x/node-stratum-pool#credits)
This is beta software. THIS FORK IS USED FOR ZCLASSIC DONATION POOL ONLY. https://fund.zclassic.org/ Highly modified with 100% Fee goes to Zclassic treasury fund wallet and Miners get 1.25 BTCP Per zcl mined after the fork.


License
Expand Down
8 changes: 8 additions & 0 deletions coins/btcprivate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "btcprivate",
"symbol": "btcp",
"algorithm": "equihash",
"requireShielding": true,
"peerMagic": "",
"txfee": 0.0004
}
8 changes: 8 additions & 0 deletions coins/btcprivate_testnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "btcprivate_testnet",
"symbol": "bttt",
"algorithm": "equihash",
"requireShielding": true,
"peerMagic": "",
"txfee": 0.0004
}
1 change: 1 addition & 0 deletions coins/zclassic.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"symbol": "zcl",
"algorithm": "equihash",
"requireShielding": true,
"peerMagicTestnet": "fa1af9bf",
"peerMagic": "24e92764",
"txfee": 0.0004
}
8 changes: 8 additions & 0 deletions coins/zclassic_testnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "zclassic_testnet",
"symbol": "zct",
"algorithm": "equihash",
"requireShielding": true,
"peerMagic": "fa1af9bf",
"txfee": 0.0004
}
Binary file added dump.rdb
Binary file not shown.
16 changes: 8 additions & 8 deletions init.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if (cluster.isWorker){
}

return;
}
}


//Read all pool configs from pool_configs and join them with their coin profile
Expand Down Expand Up @@ -194,7 +194,7 @@ var spawnPoolWorkers = function(){

var redisConfig;
var connection;

Object.keys(poolConfigs).forEach(function(coin){
var pcfg = poolConfigs[coin];
if (!Array.isArray(pcfg.daemons) || pcfg.daemons.length < 1){
Expand Down Expand Up @@ -261,15 +261,15 @@ var spawnPoolWorkers = function(){
var lastShareTime = now;
var lastStartTime = now;
var workerAddress = msg.data.worker.split('.')[0];

// if needed, initialize PPLNT objects for coin
if (!_lastShareTimes[msg.coin]) {
_lastShareTimes[msg.coin] = {};
}
if (!_lastStartTimes[msg.coin]) {
_lastStartTimes[msg.coin] = {};
}

// did they just join in this round?
if (!_lastShareTimes[msg.coin][workerAddress] || !_lastStartTimes[msg.coin][workerAddress]) {
_lastShareTimes[msg.coin][workerAddress] = now;
Expand All @@ -281,15 +281,15 @@ var spawnPoolWorkers = function(){
lastShareTime = _lastShareTimes[msg.coin][workerAddress];
lastStartTime = _lastStartTimes[msg.coin][workerAddress];
}

var redisCommands = [];

// if its been less than 15 minutes since last share was submitted
var timeChangeSec = roundTo(Math.max(now - lastShareTime, 0) / 1000, 4);
//var timeChangeTotal = roundTo(Math.max(now - lastStartTime, 0) / 1000, 4);
if (timeChangeSec < 900) {
// loyal miner keeps mining :)
redisCommands.push(['hincrbyfloat', msg.coin + ':shares:timesCurrent', workerAddress, timeChangeSec]);
redisCommands.push(['hincrbyfloat', msg.coin + ':shares:timesCurrent', workerAddress, timeChangeSec]);
//logger.debug('PPLNT', msg.coin, 'Thread '+msg.thread, workerAddress+':{totalTimeSec:'+timeChangeTotal+', timeChangeSec:'+timeChangeSec+'}');
connection.multi(redisCommands).exec(function(err, replies){
if (err)
Expand All @@ -300,7 +300,7 @@ var spawnPoolWorkers = function(){
_lastStartTimes[workerAddress] = now;
logger.debug('PPLNT', msg.coin, 'Thread '+msg.thread, workerAddress+' re-joined.');
}

// track last time share
_lastShareTimes[msg.coin][workerAddress] = now;
}
Expand Down
52 changes: 36 additions & 16 deletions libs/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,20 @@ module.exports = function(logger, portalConfig, poolConfigs){
break;
case 'payments':
var poolBlocks = [];
for(var pool in portalStats.stats.pools) {
poolBlocks.push({name: pool, pending: portalStats.stats.pools[pool].pending, payments: portalStats.stats.pools[pool].payments});
if (req.url.indexOf("?")>0) {
var url_parms = req.url.split("?");
if (url_parms.length > 0) {
if(url_parms[1] === "pending"){
for(var pool in portalStats.stats.pools) {
poolBlocks.push({name: pool, pending: portalStats.stats.pools[pool].pending});
}
}
}
} else {
/* for(var pool in portalStats.stats.pools) {
poolBlocks.push({name: pool, pending: portalStats.stats.pools[pool].pending, payments: portalStats.stats.pools[pool].payments});
} */
}
res.header('Content-Type', 'application/json');
res.end(JSON.stringify(poolBlocks));
return;
Expand All @@ -43,6 +54,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
var url_parms = req.url.split("?");
if (url_parms.length > 0) {
var history = {};

var workers = {};
var address = url_parms[1] || null;
//res.end(portalStats.getWorkerStats(address));
Expand All @@ -56,6 +68,9 @@ module.exports = function(logger, portalConfig, poolConfigs){
var totalHash = parseFloat(0.0);
var totalShares = shares;
var networkSols = 0;
var totalZCL = 0;
var minerShares = [];

for (var h in portalStats.statHistory) {
for(var pool in portalStats.statHistory[h].pools) {
for(var w in portalStats.statHistory[h].pools[pool].workers){
Expand All @@ -72,6 +87,23 @@ module.exports = function(logger, portalConfig, poolConfigs){
//console.log(portalStats.statHistory[h].time);
}
}

for(var pool in portalStats.stats.pools) {
//console.log(portalStats.stats.pools[pool].payments);
for(var p in portalStats.stats.pools[pool].payments){
var totalMinerShares = portalStats.stats.pools[pool].payments[p].shares;
var blockNum = portalStats.stats.pools[pool].payments[p].blocks[0];
var blockWork = 0;
var time = portalStats.stats.pools[pool].payments[p].blocks[0].time;
var blockWork = portalStats.stats.pools[pool].payments[p].work[address];
if(blockWork){
var percent = (blockWork / totalMinerShares) * 100;
minerShares.push({time: time, blockNum: blockNum, blockWork: blockWork, blockPercent: percent});
totalZCL += (blockWork / totalMinerShares) * 12.5;
}
}
}

for(var pool in portalStats.stats.pools) {
for(var w in portalStats.stats.pools[pool].workers){
if (w.startsWith(address)) {
Expand All @@ -89,7 +121,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
}
}
}
res.end(JSON.stringify({miner: address, totalHash: totalHash, totalShares: totalShares, networkSols: networkSols, immature: balances.totalImmature, balance: balances.totalHeld, paid: balances.totalPaid, workers: workers, history: history}));
res.end(JSON.stringify({miner: address, totalZCL: totalZCL, minerShares: minerShares, totalHash: totalHash, totalShares: totalShares, networkSols: networkSols, immature: balances.totalImmature, balance: balances.totalHeld, paid: balances.totalPaid, workers: workers, history: history}));
});
});
} else {
Expand All @@ -103,19 +135,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
}
return;
case 'live_stats':
res.writeHead(200, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive'
});
res.write('\n');
var uid = Math.random().toString();
_this.liveStatConnections[uid] = res;
res.flush();
req.on("close", function() {
delete _this.liveStatConnections[uid];
});
return;
return;
default:
next();
}
Expand Down
Loading