From ea8226ccac01d31c26f3ddee0e69fddb0edf7bdd Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Fri, 17 Feb 2017 16:08:36 -0800 Subject: [PATCH 1/3] Minergate bypass --- lib/pool.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index 2114211..246b84b 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -184,7 +184,7 @@ let VarDiff = (function () { }; })(); -function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port) { +function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port, agent) { // Username Layout -
. // Password Layout - .. // Default function is to use the password so they can login. Identifiers can be unique, payment ID is last. @@ -195,6 +195,9 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer let pass_split = pass.split(":"); this.error = ""; this.identifier = pass_split[0]; + if (agent.contains('MinerGate')){ + this.identifier = "MinerGate"; + } this.paymentID = null; this.valid_miner = true; this.port = port; @@ -568,13 +571,13 @@ function handleMinerData(method, params, ip, portData, sendReply, pushMessage) { } switch (method) { case 'login': - if (!params.login || !params.pass) { + if (!params.login || (!params.pass && !params.agent.includes('MinerGate'))) { sendReply("No login/password specified"); return; } let difficulty = portData.difficulty; let minerId = uuidV4(); - miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port); + miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port, params.agent); if (!miner.valid_miner) { console.log("Invalid miner, disconnecting due to: " + miner.error); sendReply(miner.error); From 33e2f08eeb77033c66a32b5eb059bc7d674657eb Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Fri, 17 Feb 2017 16:13:58 -0800 Subject: [PATCH 2/3] NiceHash fixing at 90k diff. --- lib/coins/xmr.js | 2 ++ lib/pool.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/coins/xmr.js b/lib/coins/xmr.js index 5365ce1..44259b6 100644 --- a/lib/coins/xmr.js +++ b/lib/coins/xmr.js @@ -33,6 +33,8 @@ function Coin(data){ this.intPrefix = 54; } + this.niceHashDiff = 90000; + this.getBlockHeaderByID = function(blockId, callback){ global.support.rpcDaemon('getblockheaderbyheight', {"height": blockId}, function (body) { if (body.hasOwnProperty('result')){ diff --git a/lib/pool.js b/lib/pool.js index 246b84b..b816ed4 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -195,7 +195,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer let pass_split = pass.split(":"); this.error = ""; this.identifier = pass_split[0]; - if (agent.contains('MinerGate')){ + if (agent.includes('MinerGate')){ this.identifier = "MinerGate"; } this.paymentID = null; @@ -223,6 +223,10 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer this.fixed_diff = false; this.difficulty = startingDiff; this.connectTime = Date.now(); + if (agent.includes('NiceHash')){ + this.fixed_diff = true; + this.difficulty = global.coinFuncs.niceHashDiff; + } if (diffSplit.length === 2) { this.fixed_diff = true; this.difficulty = Number(diffSplit[1]); From 72a12bff82980ec24c002aad82392aee21efed26 Mon Sep 17 00:00:00 2001 From: Mine Coins Date: Sun, 19 Feb 2017 09:13:54 +0200 Subject: [PATCH 3/3] REAMDE: config.json is already created by deploy.bash / renamed poolui --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f27c3f..563f4c4 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ Deployment via Installer 1. Add your user to `/etc/sudoers`, this must be done so the script can sudo up and do it's job. We suggest passwordless sudo. Suggested line: ` ALL=(ALL) NOPASSWD:ALL`. Our sample builds use: `pooldaemon ALL=(ALL) NOPASSWD:ALL` 2. Run the [deploy script](https://raw.githubusercontent.com/Snipa22/nodejs-pool/master/deployment/deploy.bash) as a **NON-ROOT USER**. This is very important! This script will install the pool to whatever user it's running under! Also. Go get a coffee, this sucker bootstraps the monero installation. -3. Once it's complete, copy `config_example.json` to `config.json` and change as appropriate. It is pre-loaded for a local install of everything, running on 127.0.0.1. This will work perfectly fine if you're using a single node setup. You will also want to run: source ~/.bashrc This will activate NVM and get things working for the following pm2 steps. -4. You'll need to change the API end point for the frontend code in the `xmrpoolui/app/utils/services.js` -- This will usually be `http:///api` unless you tweak caddy! +3. Once it's complete, change as `config.json` appropriate. It is pre-loaded for a local install of everything, running on 127.0.0.1. This will work perfectly fine if you're using a single node setup. You will also want to run: source ~/.bashrc This will activate NVM and get things working for the following pm2 steps. +4. You'll need to change the API end point for the frontend code in the `poolui/app/utils/services.js` -- This will usually be `http:///api` unless you tweak caddy! 5. Change the `db_storage_path` in `config.json` for your database directory to: `/home//pool_db/` The directory's already been created during startup. Or change as appropriate! Just make sure your user has write permissions, then run: `pm2 restart api` to reload the API for usage You'll also want to set `bind_ip` to the external IP of the pool server, and hostname to the resolvable hostname for the pool server. `pool_id` is mostly used for multi-server installations to provide unique identifiers in the backend. 6. Hop into the web interface (Should be at `http:///#/admin`), then login with `Administrator/Password123`, **MAKE SURE TO CHANGE THIS PASSWORD ONCE YOU LOGIN**. *<- This step is currently not active, we're waiting for the frontend to catch up! Head down to the Manual SQL Configuration to take a look at what needs to be done by hand for now*. 7. From the admin panel, you can configure all of your pool's settings for addresses, payment thresholds, etc.