ZCash Stratum proxy (Increase earning up to 10%)

#1

Hi guys.
We released today the first Open-Source ZCash Stratum proxy, which streamlines mining on multi-miners infrastructures/farms (also helpful for small/personal mining farms).
This software is provides AS-IS without dev-fee and without any warranties of any kind.

Source code (nodejs) and instructions are available on Github:

Zecproxy v1.0.0

This proxy has been tested with flypool and nanopool successfully.
Tested with EWBF’s Zcash CUDA miner. 0.3.4b

Main Features

  • Zcash stratum proxy
  • Additional up to 10-20% increase of earning compared to standard pools
  • Pool failover system
  • Only one connection to the pool
  • Workers get new jobs immediately
  • Submit of shares without network delay, it’s like solo-mining but with benefits of professional pool
  • Central Wallet configuration, miners doesn’t need wallet as username
  • Bypasse worker_id for detailed statistic and per rig monitoring - not supported on flypool yet / working on nanopool
  • PM2 support

Donations

  • ETH: 0x1212eF39d945aB9A9568Aa5a72c5CBA99Bbe46c1
  • ZEC: t1YAdYcnKR2ozADWPUvmgnDgf86gfsxQEEE

License

This software is provides AS-IS without dev-fee and without any warranties of any kind.
Please use at your own risk.
Enjoy !


Original forum.zcashcommunity.com thread :
[BOUNTY] ZEC Proxy development

4 Likes
Render farm change to miner farm
Mining Ethernet connection
#2

Hi guys,
Today, we fixed an important bug on zecproxy (it became unstable after a peer disconnection…)
Please update the code to version 1.0.1
Enjoy

#3

Hi guys
We just releaded the version 1.0.4.

Change log :

  • Stability improvements
  • Reconnection bugfixes
  • False share rejection fix
  • Authentication logging
  • SSL encrypted connection support

Enjoy !

1 Like
#4

can you explain the advantages of using a stratum proxy to a noob like me please? :slightly_smiling_face:
why earnings increase?

thanks for your work,

2 Likes
#5

Awesome! I will be using this for sure! @PistoleDev I may need a little bit of help setting this up. Can you help me?

#6

Interesting, I wrote a quick Dockerfile to test this.

FROM node:alpine
RUN apk add --no-cache -U git && \
    git clone --depth 1 https://github.com/BScrk/zecproxy.git && \
    npm install zecproxy && \
    apk del git

EXPOSE 8000
WORKDIR /zecproxy
COPY config.json .
CMD ["node", "proxy.js"]
1 Like
#7

Hi @n0g1291
First of all, find here a small scema of how a stratum proxy works :

  Pool A < ---+                         +------------- > Rig 1 / Worker 1
 (Active)     |                         |
              |                         +------------- > Rig 2 / Worker 2
              |                         |
  Pool B < ---+--- > StratumProxy < ----+------------- > Rig 3 / Worker 3
(FailOver)                              |
                                        +------------- > Rig 4 / Worker 4       

There are several main advantages :

  • First of all, the stratum json-rpc communication protocol is much more efficient than the HTTP “get work” version in term of latency & bandwidth usage. Even if modern miners support the tcp/ssl stratum protocol as well, using a stratum proxy allow you to aggregate communications with the pool in one unique point.

  • The Stratum proxy is like a “personal” pool, the work submission and new work reception are centralized by the proxy and sent directly to the miners through the local network instead of maintaining N open connections through the web (this is particularly effective with several rigs/workers).

  • From the pool point of view, having more and more miners/workers to deal with increases dramatically bandwidth/ressources usage. By using proxies we all contribute to pools workload reduction and so increase community efficiency :slight_smile:

  • By aggregating your workers hashrates through an unique “virtual miner” (which stratum proxy does), you increase by design the number of shares you validate per Hash/sol. In addition, the proxy always has the latest block informations (target / work) from the mining pool so it can quicky provide it to miners according to their needs (new one / reconnected / etc…)

  • With your own stratum proxy you have an unique point of monitoring :wink: . For now you can see if your rigs are alive or not by “simply” scanning the output log, and we are working on an better monitoring way (console UI + Json api…), this will coming soon !

So basically, if you have more than 1 worker, the proxy usage will optimize you mining setup and earnings.

2 Likes
Mining with a computer cluster. Does it make sense?
#8

Hi @deke997
Sure, what do you need ?

#9

Downloading Raspbian now as I may finally have a use for my Raspberry Pi.

1 Like
#10

Got it running on a Raspberry Pi with this systemd service file

[Unit]                                                                                         
Description=Zecproxy Service                                                                   
Wants=network-online.target                                                                    
After=network-online.target                                                                    

[Service]                                                                                      
ExecStart=/usr/bin/nodejs proxy.js                                                             
WorkingDirectory=/opt/zecproxy                                                                 
User=nobody                                                                                    
KillMode=mixed                                                                                 
Restart=always                                                                                 
RestartSec=10s                                                                                 
TimeoutStopSec=10                                                                              
Nice=-20                                                                                       
ProtectSystem=strict                                                                           
ProtectHome=yes                                                                                

[Install]                                                                                      
WantedBy=multi-user.target

looking at journald shows double date and timestamps

Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Zcash Stratul proxy version 1.0.4
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # PROXY IS LISTENING ON PORT 8000
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # -----------------------------------------------------------------------
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Mining Wallet: znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Worker ID enabled: true
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Failover enabled: true
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # -----------------------------------------------------------------------
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Donation ETH : 0x1212eF39d945aB9A9568Aa5a72c5CBA99Bbe46c1
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # Donation ZEC : t1YAdYcnKR2ozADWPUvmgnDgf86gfsxQEEE
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 WARN # -----------------------------------------------------------------------
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 INFO # ZEC STRATUM PROXY STARTING...
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 INFO # Connecting to zhash.pro:3057
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 INFO # Connected to pool zhash.pro:3057
Oct 12 08:39:09 raspberrypi nodejs[8100]: 2017/10/12 08:39:09 INFO # Subscribing to pool...
Oct 12 08:39:10 raspberrypi nodejs[8100]: 2017/10/12 08:39:10 INFO # Stratum session id : 48000302
Oct 12 08:39:10 raspberrypi nodejs[8100]: 2017/10/12 08:39:10 INFO # Authorizing mining wallet znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy
Oct 12 08:39:10 raspberrypi nodejs[8100]: 2017/10/12 08:39:10 INFO # New work : dfd9                                
Oct 12 08:39:10 raspberrypi nodejs[8100]: 2017/10/12 08:39:10 INFO # znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy Authorized
2 Likes
#11

Would it be possible to round robin load balance between multiple pools?

1 Like
#12

To remove date output, feel free to replace ./lib/stratum_logger.js file by the following :

var config = require('../config.json')
var date = require('date-and-time');
const chalk = require('chalk');

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var log = function (args) {  console.log(chalk.cyan(' INFO') + " # " + args); } 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var warn = function (args) {  console.log(chalk.yellow(' WARN') + " # " +args); } 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var err = function (args) { console.log(chalk.red(' ERROR') + " # " +args); } 
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var dbg = function () {
  if(config.debug){
    return Function.prototype.bind.call(console.log, console);
  }
  return ()=>{};
} ();
// ----------------------------------------------------------------------------
module.exports = {
  log,  dbg,  warn,  err
};
1 Like
#13

Replacing stratum_logger.js worked.

Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Zcash Stratul proxy version 1.0.4
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # PROXY IS LISTENING ON PORT 8000
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # -----------------------------------------------------------------------
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Mining Wallet: znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Worker ID enabled: true
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Failover enabled: true
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # -----------------------------------------------------------------------                                                                    
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Donation ETH : 0x1212eF39d945aB9A9568Aa5a72c5CBA99Bbe46c1                                                                                  
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # Donation ZEC : t1YAdYcnKR2ozADWPUvmgnDgf86gfsxQEEE
Oct 12 02:07:02 raspberrypi nodejs[1463]:  WARN # -----------------------------------------------------------------------
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # ZEC STRATUM PROXY STARTING...
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # Connecting to zhash.pro:3057
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # Connected to pool zhash.pro:3057                                                                                                           
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # Subscribing to pool...                                                                                                                     
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # Stratum session id : 4ffffd27                                                                                                              
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # Authorizing mining wallet znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # New work : dffc
Oct 12 02:07:02 raspberrypi nodejs[1463]:  INFO # znTVVSyTcZnqCkvXYhmmpbqsAp5X7LpUEvy Authorized
1 Like
#14

One downside I noticed is when using Claymore miner, its dev fee is 2% if connected using SSL and 2.5% when not connected using SSL (this man-in-the-middle proxy).

1 Like
#15

On zhash.pro each worker got recognized but on luckpool.org only the proxy shows up.

1 Like
#16

Yes, it’s the same with Flypool. They don’t implement multiple workers identification through an unique tcp/ssl connection :confused:
Nanopool / zhash does…

#17

How to run this in windows? I’ve got java node now what?

#18

Hi, does it works on Windows?

#19

Switched from running this on a Raspberry Pi 2 to Raspberry Pi Zero. Total OS memory usage is 36MB and the load average is 0.1 with 19 peers.

2 Likes
#20

Anyone tested this with ethOS and Ewbf miner?