Unified NOMP
This repo will serve as an open source multipool. Multipool capabilities are in alpha testing in this version. This will give the ability to utilize NOMP with merged capabilities but NO merged coin payouts. ONLY the main chain coins will payout and calculate correctly at the moment.
Join our Slack here!
This portal is an extremely efficient, highly scalable, all-in-one, easy to setup cryptocurrency mining pool written in Node.js.
It contains a merged stratum pool server; reward/payment/share processor for multipooling; and an (in progress)
responsive user-friendly front-end website featuring mining instructions, in-depth live statistics, and an admin center.
Production Usage Notice - Do it with caution!
This is beta software. All of the following are things that can change and break an existing 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, among other things.
Table of Contents
Features
-
For the pool server it uses the highly efficient node-merged-pool module which
supports vardiff, POW & POS, transaction messages, anti-DDoS, IP banning, several hashing algorithms.
-
This implementation is merged mining capable. You may add AUXPoW coins to the main chain configurations.
At this point, the merged coins do everything EXCEPT display on the site or payout automatically. Shares, blocks, and coinbase transactions complete as planned.
-
Multicoin ability - this software was built from the ground up to run with multiple coins simultaneously (which can
have different properties and hashing algorithms). It can be used to create a pool for a single coin or for multiple
coins at once. The pools use clustering to load balance across multiple CPU cores.
-
For reward/payment processing, shares are inserted into Redis (a fast NoSQL key/value store). The PROP (proportional)
reward system is used with Redis Transactions for secure and super speedy payouts.
There is zero risk to the pool operator. Shares from rounds resulting in orphaned blocks will be merged into share in the
current round so that each and every share will be rewarded.
-
This portal does not will never have user accounts/logins/registrations. Instead, miners simply use their coin address for stratum authentication.
-
Coin-switching ports using coin-networks and crypto-exchange APIs to detect profitability.
-
Past MPOS functionality is no longer available/working. Signing up and mining pools don't mix. See PR #15.
-
Basic multipooling features included, but NOT enabled by default. You must follow the README in the multipool folder. More updates WILL happen in the multipool options and will stay open source.
Attack Mitigation
- Detects and thwarts socket flooding (garbage data sent over socket in order to consume system resources).
- Detects and thwarts zombie miners (botnet infected computers connecting to your server to use up sockets but not sending any shares).
- Detects and thwarts invalid share attacks:
- UNOMP is not vulnerable to the low difficulty share exploits happening to other pool servers. Other pool server
software has hardcoded guesstimated max difficulties for new hashing algorithms while UNOMP dynamically generates the
max difficulty for each algorithm based on values founds in coin source code.
- IP banning feature which on a configurable threshold will ban an IP for a configurable amount of time if the miner
submits over a configurable threshold of invalid shares.
- UNOMP is written in Node.js which uses a single thread (async) to handle connections rather than the overhead of one
thread per connection, and clustering is also implemented so all CPU cores are taken advantage of. Result? Fastest stratum available.
Security
UNOMP has some implicit security advantages for pool operators and miners:
- Without a registration/login system, non-security-oriented miners reusing passwords across pools is no longer a concern.
- Automated payouts by default and pool profits are sent to another address so pool wallets aren't plump with coins -
giving hackers little reward and keeping your pool from being a target.
- Miners can notice lack of automated payments as a possible early warning sign that an operator is about to run off with their coins.
Planned Features
-
UNOMP API - Used by the website to display stats and information about the pool(s) on the portal's front-end website. Mostly complete.
-
Integration of addie.cc usernames for multiple payout type without using a public address that may/may not work with the
coin (still not 100% committed yet, see Feature #7)
-
Upgrade codebase to operate in node v 0.12. Complete. If you run into problems, please open an issue.
Usage
Requirements
- Coin daemon(s) (find the coin's repo and build latest version from source)
- Install node.js (correct procedure below)
- Install npm (correct procedure below)
- Redis key-value store v2.6+ (follow these instructions)
OPTIONAL: sudo npm install posix
, but you will have to start the pool sudo node init.js
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: 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.
Redis server may require a password, this is done using the requirepass directive in the redis configuration file.
By default config.json contains blank "" - means disabled redis auth, to set any password just put "redispass" in quotes.
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=litecoinrpc
rpcpassword=securepassword
rpcport=19332
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:
1) Downloading & Installing
Clone the repository and run npm update
for all the dependencies to be installed:
sudo apt-get install build-essential libssl-dev npm nodejs nodejs-legacy
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm install 0.10.25
nvm use 0.10.25
git clone https://github.com/UNOMP/unified-node-open-mining-portal.git unomp
cd unomp
npm update
2) Configuration
Portal config
Inside the config_example.json
file, ensure the default configuration will work for your environment, then copy the file to config.json
.
Explanation for each field:
{
"logLevel": "debug",
"logColors": true,
"cliPort": 17117,
"clustering": {
"enabled": true,
"forks": "auto"
},
"defaultPoolConfigs": {
"blockRefreshInterval": 1000,
"jobRebroadcastTimeout": 55,
"connectionTimeout": 600,
"emitInvalidBlockHashes": false,
"validateWorkerUsername": true,
"tcpProxyProtocol": false,
"banning": {
"enabled": true,
"time": 600,
"invalidPercent": 50,
"checkThreshold": 500,
"purgeInterval": 300
},
"redis": {
"host": "127.0.0.1",
"port": 6379,
"db": 0,
"password": ""
}
},
"website": {
"enabled": true,
"host": "0.0.0.0",
"siteTitle": "UNOMP Beta",
"port": 8080,
"stratumHost": "pool.unomp.org",
"stats": {
"updateInterval": 15,
"historicalRetention": 43200,
"hashrateWindow": 300
},
"adminCenter": {
"enabled": true,
"password": "password"
}
},
"redis": {
"host": "127.0.0.1",
"port": 6379,
"db": 0,
"password": ""
},
"switching": {
"switch1": {
"enabled": false,
"algorithm": "sha256",
"ports": {
"3333": {
"diff": 10,
"varDiff": {
"minDiff": 16,
"maxDiff": 512,
"targetTime": 15,
"retargetTime": 90,
"variancePercent": 30
}
}
}
},
"switch2": {
"enabled": false,
"algorithm": "scrypt",
"ports": {
"4444": {
"diff": 10,
"varDiff": {
"minDiff": 16,
"maxDiff": 512,
"targetTime": 15,
"retargetTime": 90,
"variancePercent": 30
}
}
}
},
"switch3": {
"enabled": false,
"algorithm": "x11",
"ports": {
"5555": {
"diff": 0.001
}
}
}
},
"profitSwitch": {
"enabled": false,
"updateInterval": 600,
"depth": 0.90,
"usePoloniex": true,
"useCryptsy": true,
"useBittrex": true
}
}
Coin config
Inside the coins
directory, ensure a json file exists for your coin. If it does not you will have to create it.
Here is an example of the required fields:
{
"name": "Litecoin",
"symbol": "LTC",
"algorithm": "scrypt",
"peerMagic": "fbc0b6db",
"peerMagicTestnet": "fcc1b7dc"
}
For additional documentation how to configure coins and their different algorithms
see these instructions.
Pool config
Take a look at the example json file inside the pool_configs
directory. Rename it to yourcoin.json
and change the
example fields to fit your setup.
Description of options:
{
"enabled": true,
"coin": "litecoin.json",
"auxes": [
{
"coin": "viacoin.json",
"daemons": [
{
"host": "127.0.0.1",
"port": 4001,
"user": "user",
"password": "password"
}
]
}
],
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc",
"rewardRecipients": {
"n37vuNFkXfk15uFnGoVyHZ6PYQxppD3QqK": 1.5,
"mirj3LtZxbSTharhtXvotqtJXUY7ki5qfx": 0.5
},
"paymentProcessing": {
"enabled": true,
"paymentInterval": 30,
"minimumPayment": 0.01,
"daemon": {
"host": "127.0.0.1",
"port": 4000,
"user": "testuser",
"password": "testpass"
}
},
"ports": {
"3032": {
"diff": 32,
"varDiff": {
"minDiff": 8,
"maxDiff": 512,
"targetTime": 15,
"retargetTime": 90,
"variancePercent": 30
}
},
"3256": {
"diff": 256
}
},
"daemons": [
{
"host": "127.0.0.1",
"port": 4000,
"user": "testuser",
"password": "testpass"
}
],
"p2p": {
"enabled": false,
"host": "127.0.0.1",
"port": 19333,
"disableTransactions": true
},
}
You can create as many of these pool config files as you want (such as one pool per coin you which to operate).
If you are creating multiple pools, ensure that they have unique stratum ports.
For more information on these configuration options see the pool module documentation
[Optional, recommended] Setting up blocknotify
- In
config.json
set the port and password for blockNotifyListener
- 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 dogecoin.conf
add the line
blocknotify=node /home/unomp/scripts/cli.js blocknotify dogecoin %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.
3) Start the portal
node init.js
Optional, highly-recommended enhancements for your awesome new mining pool server setup:
- Use something like forever to keep the node script running
in case the master process crashes.
- Use something like redis-commander to have a nice GUI
for exploring your redis database.
- Use something like logrotator to rotate log
output from UNOMP.
- Use New Relic to monitor your UNOMP instance and server performance.
Upgrading
When updating UNOMP to the latest code its important to not only git pull
the latest from this repo, but to also update
the merged-pooler
and node-multi-hashing
modules, and any config files that may have been changed.
- Inside your UNOMP directory (where the init.js script is) do
git pull
to get the latest UNOMP 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. You may need to modify or add any new changes.
Donations
Below is my donation address. The original credits are listed here because I felt scammy if I totally removed them. They no longer are supporting the current development effort. Please donate to:
- BTC:
19svwpxWAhD4zsfeEnnxExZgnQ46A3mrt3
Donors (email me to be added):
License
Released under the GNU General Public License v2
http://www.gnu.org/licenses/gpl-2.0.html