diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b512c09d4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore index 185bb0528..c9f6162e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ node_modules/ .idea/ pool_configs/*.json !pool_configs/litecoin_example.json -!pool_configs/riecoin.json +!pool_configs/garlicoin.json +docker-compose.yaml +config/ +npm-debug.log \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2c27c68b0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM node:9.4.0 + +RUN echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" > /etc/apt/sources.list.d/unstable.list &&\ + apt-get update &&\ + apt-get install --assume-yes -t unstable gcc-5 libgmp3-dev g++-5 &&\ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5 &&\ + cc --version + +RUN mkdir -p /opt/node-open-mining-portal + +COPY package.json /opt/node-open-mining-portal/ +COPY package-lock.json /opt/node-open-mining-portal/ + +WORKDIR /opt/node-open-mining-portal + +RUN npm install && echo 4 + +COPY . /opt/node-open-mining-portal/ + +RUN rm -rf /opt/node-open-mining-portal/pool_configs +RUN ln -s /opt/config/config.json /opt/node-open-mining-portal/config.json +RUN ln -s /opt/config/pool_configs /opt/node-open-mining-portal/ + +VOLUME ["/opt/config"] + +EXPOSE 80 +EXPOSE 3333 + +CMD node init.js diff --git a/README.md b/README.md index 2575f02ee..50f10ecdc 100644 --- a/README.md +++ b/README.md @@ -161,12 +161,12 @@ a good pool operator. For starters be sure to read: #### 1) Downloading & Installing -Clone the repository and run `npm update` for all the dependencies to be installed: +Clone the repository and run `npm install` for all the dependencies to be installed: ```bash git clone https://github.com/zone117x/node-open-mining-portal.git nomp cd nomp -npm update +npm install ``` #### 2) Configuration @@ -347,6 +347,9 @@ Here is an example of the required fields: "symbol": "ltc", "algorithm": "scrypt", + // Coinbase value is what is added to a block when it is mined, set this to your pool name so + // explorers can see which pool mined a particular block. + "coinbase": "Kryptonite", /* Magic value only required for setting up p2p block notifications. It is found in the daemon source code as the pchMessageStart variable. For example, litecoin mainnet magic: http://git.io/Bi8YFw @@ -530,7 +533,7 @@ When updating NOMP to the latest code its important to not only `git pull` the l the `node-stratum-pool` and `node-multi-hashing` modules, and any config files that may have been changed. * Inside your NOMP directory (where the init.js script is) do `git pull` to get the latest 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. +* Run `npm install` 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. You may need to modify or add any new changes. Donations diff --git a/coins/garlicoin.json b/coins/garlicoin.json new file mode 100644 index 000000000..d119d9b25 --- /dev/null +++ b/coins/garlicoin.json @@ -0,0 +1,11 @@ +{ + "name": "Garlicoin", + "symbol": "GRLC", + "algorithm": "allium", + + "//": "Coinbase will let explorers know who mined the block, change this to your pool name", + "coinbase": "HaventChangedTheConfig", + + "peerMagic": "d2c6b6db", + "peerMagicTestnet": "fdd2c8f2" +} diff --git a/config.json b/config.json deleted file mode 100644 index 7517c00d6..000000000 --- a/config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "logLevel": "debug", - "logColors": true, - - "cliPort": 17117, - - "clustering": { - "enabled": true, - "forks": "auto" - }, - - "defaultPoolConfigs": { - "blockRefreshInterval": 5000, - "jobRebroadcastTimeout": 55, - "connectionTimeout": 180, - "emitInvalidBlockHashes": false, - "validateWorkerUsername": true, - "tcpProxyProtocol": true, - "shareDiff": 5, - "banning": { - "enabled": true, - "time": 600, - "invalidPercent": 50, - "checkThreshold": 500, - "purgeInterval": 300 - }, - "redis": { - "host": "127.0.0.1", - "port": 6379 - } - }, - - "website": { - "enabled": true, - "host": "0.0.0.0", - "port": 8080, - "stratumHost": "", - "stats": { - "updateInterval": 60, - "historicalRetention": 43200, - "hashrateWindow": 300 - }, - "adminCenter": { - "enabled": true, - "password": "password" - } - }, - - "redis": { - "host": "127.0.0.1", - "port": 6379 - }, - - "switching": { - "switch1": { - "enabled": false, - "algorithm": "sha256", - "ports": { - "2222": { - "diff": 10, - "varDiff": { - "minDiff": 16, - "maxDiff": 512, - "targetTime": 15, - "retargetTime": 90, - "variancePercent": 30 - } - } - } - }, - "switch2": { - "enabled": false, - "algorithm": "scrypt", - "ports": { - "3333": { - "diff": 10, - "varDiff": { - "minDiff": 16, - "maxDiff": 512, - "targetTime": 15, - "retargetTime": 90, - "variancePercent": 30 - } - } - } - }, - "switch3": { - "enabled": false, - "algorithm": "x11", - "ports": { - "4443": { - "diff": 0.001, - "varDiff": { - "minDiff": 0.001, - "maxDiff": 1, - "targetTime": 15, - "retargetTime": 60, - "variancePercent": 30 - } - } - } - } - }, - - "profitSwitch": { - "enabled": false, - "updateInterval": 600, - "depth": 0.90, - "usePoloniex": true, - "useCryptsy": true, - "useMintpal": true, - "useBittrex": true - } -} diff --git a/libs/paymentProcessor.js b/libs/paymentProcessor.js index 30b7b4a97..3b05e30b7 100644 --- a/libs/paymentProcessor.js +++ b/libs/paymentProcessor.js @@ -354,6 +354,12 @@ function SetupForPool(logger, poolOptions, setupFinished) { return; } + for (var key in workerShares) { + if (workerShares.hasOwnProperty(key) && key.length !== 34) { + delete workerShares[key]; + } + } + switch (round.category) { case 'kicked': case 'orphan': diff --git a/libs/poolWorker.js b/libs/poolWorker.js index 0c1b74b80..e10a4a1f2 100644 --- a/libs/poolWorker.js +++ b/libs/poolWorker.js @@ -171,6 +171,11 @@ module.exports = function(logger){ var authorizeFN = function (ip, port, workerName, password, callback) { handlers.auth(port, workerName, password, function(authorized){ + if(authorized){ + if(workerName.length !== 34){ + authorized = false; + } + } var authString = authorized ? 'Authorized' : 'Unauthorized '; diff --git a/package.json b/package.json index 7591f7dbf..cdcf4d2d6 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ric-nomp", + "name": "grlc-nomp", "version": "0.0.4", "description": "An extremely efficient, highly scalable, all-in-one, easy to setup cryptocurrency mining pool", "keywords": [ @@ -12,9 +12,9 @@ "litecoin", "scrypt" ], - "homepage": "https://github.com/vagabondan/ric-nomp", + "homepage": "https://github.com/garlicoin-project/grlc-nomp", "bugs": { - "url": "https://github.com/vagabondan/ric-nomp/issues" + "url": "https://github.com/garlicoin-project/grlc-nomp/issues" }, "license": "GPL-2.0", "author": "Matthew Little", @@ -28,7 +28,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/vagabondan/ric-nomp.git" + "url": "https://github.com/garlicoin-project/grlc-nomp.git" }, "dependencies": { "async": "^2.5.0", @@ -46,7 +46,7 @@ "nonce": "^1.0.4", "redis": "^2.7.1", "request": "^2.81.0", - "stratum-pool": "git://github.com/vagabondan/node-stratum-pool.git" + "stratum-pool": "git://github.com/garlicoin-project/grlc-node-stratum-pool.git#2af9266" }, "engines": { "node": ">=6.11.2" diff --git a/pool_configs/garlicoin.json b/pool_configs/garlicoin.json new file mode 100644 index 000000000..a7a0d7d75 --- /dev/null +++ b/pool_configs/garlicoin.json @@ -0,0 +1,51 @@ +{ + "enabled": true, + "coin": "garlicoin.json", + + "address": "mvtv43LtsQSeyCaBBb8xRj5ZpNt75zDX21", + + "rewardRecipients": { + "mvtv43LtsQSeyCaBBb8xRj5ZpNt75zDX21": 5 + }, + + "paymentProcessing": { + "enabled": true, + "paymentInterval": 20, + "minimumPayment": 0.1, + "daemon": { + "host": "127.0.0.1", + "port": 42068, + "user": "user", + "password": "password" + } + }, + + "ports": { + "3333": { + "diff": 8, + "varDiff": { + "minDiff": 8, + "maxDiff": 512, + "targetTime": 15, + "retargetTime": 90, + "variancePercent": 30 + } + } + }, + + "p2p": { + "enabled": false, + "host": "127.0.0.1", + "port": 42069, + "disableTransactions": true + }, + + "daemons": [ + { + "host": "127.0.0.1", + "port": 42068, + "user": "user", + "password": "password" + } + ] +} diff --git a/pool_configs/riecoin.json b/pool_configs/riecoin.json deleted file mode 100644 index dc3fe10b8..000000000 --- a/pool_configs/riecoin.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "enabled": false, - "coin": "riecoin.json", - - "address": "RSoTqUcauJewHZYmPnM8w3p1LVcV5C2Fh1", - - "rewardRecipients": { - "RF85xKkjgdSRm3NUfSTikpeJdis56kaRUn": 0 - }, - - "paymentProcessing": { - "enabled": false, - "paymentInterval": 60, - "minimumPayment": 1, - "daemon": { - "host": "127.0.0.1", - "port": 28332, - "user": "user", - "password": "pass" - } - }, - - "ports": { - "3333": { - "diff": 4 - } - }, - - "daemons": [ - { - "host": "127.0.0.1", - "port": 28332, - "user": "user", - "password": "pass" - } - ], - - "p2p": { - "enabled": false, - "host": "127.0.0.1", - "port": 19333, - "disableTransactions": true - }, - - "mposMode": { - "enabled": false, - "host": "127.0.0.1", - "port": 3306, - "user": "pool", - "password": "incipio", - "database": "mpos", - "checkPassword": true, - "autoCreateWorker": false - } - -} diff --git a/start.sh b/start.sh new file mode 100755 index 000000000..aa451a5bf --- /dev/null +++ b/start.sh @@ -0,0 +1,8 @@ +docker run --rm -it \ + --name nomp \ + -v $(pwd)/config:/opt/config \ + --network=garlicoin-test \ + --entrypoint=/bin/bash \ + -p 80:80 \ + -p 3333:3333 \ + nomp