NOTICE: If you have problems with orphan blocks, read this first: forknote#48
High performance Node.js (with native C addons) mining pool for Cryptonote based coins, created with the Forknote software such as Bytecoin, Dashcoin, etc..
Comes with lightweight example front-end script which uses the pool's AJAX API.
This pool is configured for Properteum Coins
It works fine with Ubuntu 14.04. and latest version of Properteum Repo (forknote) with Boost 1.55 - solved issue with Allow Origins in src. Or use Ubuntu 16.04 with latest version of forknote. Use Node 0.10.25 (or 0.10.48), Redis 2.6.14 and (Boost 1.58 for Ubuntu 16.04. or Boost 1.55 for Ubuntu 14.04.)
The Properteum Forknote Repo (stable Version) works at this time only with Boost 1.55 - in a few days we do a update. Thanks!
Do this to install right Node-Version (0.10.25):
- $ sudo apt-get remove npm nodejs -y
- $ wget https://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz && tar xvzf node-v0.10.25.tar.gz
- $ cd node-v0.10.25
- $ make
- $ sudo make install
Install Redis manually! Here we go:
- $ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/redis/redis-2.6.14.tar.gz
- $ tar xvzf redis-2.6.14.tar.gz
- $ make
- $ sudo make install
- $ cd utils
- $ sudo ./install_server.sh
We changed some things:
- Blockchain Explorer
- Enable Cors Header (apache2.conf) - Only for testmode in non ssl connections! Risk warning!
- Admin Logout / Back to Frontend
- And other little needed things
- Added .htaccess for redirect non ssl to ssl - Only use, if SSL Certificate is used.
- Features
- Community Support
- Pools Using This Software
- Usage
- Setting up Testnet
- JSON-RPC Commands from CLI
- Monitoring Your Pool
- Configuring Blockchain Explorer
- Pool-Mining for Beginners
- Credits
- License
- TCP (stratum-like) protocol for server-push based jobs
- Compared to old HTTP protocol, this has a higher hash rate, lower network/CPU server load, lower orphan block percent, and less error prone
- IP banning to prevent low-diff share attacks
- Socket flooding detection
- Payment processing
- Splintered transactions to deal with max transaction size
- Minimum payment threshold before balance will be paid out
- Minimum denomination for truncating payment amount precision to reduce size/complexity of block transactions
- Detailed logging
- Ability to configure multiple ports - each with their own difficulty
- Variable difficulty / share limiter
- Share trust algorithm to reduce share validation hashing CPU load
- Clustering for vertical scaling
- Modular components for horizontal scaling (pool server, database, stats/API, payment processing, front-end)
- Live stats API (using AJAX long polling with CORS)
- Currency network/block difficulty
- Current block height
- Network hashrate
- Pool hashrate
- Each miners' individual stats (hashrate, shares submitted, pending balance, total paid, etc)
- Blocks found (pending, confirmed, and orphaned)
- An easily extendable, responsive, light-weight front-end using API to display data
- Admin panel
- Aggregated pool statistics
- Coin daemon & wallet RPC services stability monitoring
- Log files data access
- Users list with detailed statistics
- Historic charts of pool's hashrate and miners count, coin difficulty, rates and coin profitability
- Historic charts of users's hashrate and payments
- Miner login(wallet address) validation
- Five configurable CSS themes
- Universal blocks and transactions explorer based on chainradar.com
- FantomCoin & MonetaVerde support
- Set fixed difficulty on miner client by passing "address" param with ".[difficulty]" postfix
- Prevent "transaction is too big" error with "payments.maxTransactionAmount" option
- Coin daemon(s) (find the coin's repo and build latest version from source)
- simplewallet (Bytecoin/Forknote v1.1.11). Do NOT use Forknote 2.0.0, since it's in alpha
* [Node.js](http://nodejs.org/) v0.10+ ([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))
* libssl required for the node-multi-hashing module
* For Ubuntu: `sudo apt-get install libssl-dev`
##### 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).
##### Easy install on Ubuntu 14 LTS
Installing pool on different Linux distributives is different because it depends on system default components and versions. For now the easiest way to install pool is to use Ubuntu 14 LTS. Thus, all you had to do in order to prepare Ubunty 14 for pool installation is to run:
```bash
sudo apt-get install git build-essential redis-server libboost1.55-all-dev nodejs-dev nodejs-legacy npm cmake libssl-dev
Clone the repository and run npm update
for all the dependencies to be installed:
git clone https://github.com/forknote/cryptonote-universal-pool.git pool
cd pool
npm update
Explanation for each field:
/* Used for storage in redis so multiple coins can share the same redis instance. */
"coin": "dashcoin",
/* Used for front-end display */
"symbol": "DSH",
/* Minimum units in a single coin, see COIN constant in DAEMON_CODE/src/cryptonote_config.h */
"coinUnits": 1000000000000,
/* Coin network time to mine one block, see DIFFICULTY_TARGET constant in DAEMON_CODE/src/cryptonote_config.h */
"coinDifficultyTarget": 120,
"logging": {
"files": {
/* Specifies the level of log output verbosity. This level and anything
more severe will be logged. Options are: info, warn, or error. */
"level": "info",
/* Directory where to write log files. */
"directory": "logs",
/* How often (in seconds) to append/flush data to the log files. */
"flushInterval": 5
},
"console": {
"level": "info",
/* Gives console output useful colors. If you direct that output to a log file
then disable this feature to avoid nasty characters in the file. */
"colors": true
}
},
/* Modular Pool Server */
"poolServer": {
"enabled": true,
/* Set to "auto" by default which will spawn one process/fork/worker for each CPU
core in your system. Each of these workers will run a separate instance of your
pool(s), and the kernel will load balance miners using these forks. Optionally,
the 'forks' field can be a number for how many forks will be spawned. */
"clusterForks": "auto",
/* Address where block rewards go, and miner payments come from. */
"poolAddress": "D6WLtrV1SBWV8HWQzQv8uuYuGy3uwZ8ah5iT5HovSqhTKMauquoTsKP8RBJzVqVesX87poYWQgkGWB4NWHJ6Ravv93v4BaE"
/* Poll RPC daemons for new blocks every this many milliseconds. */
"blockRefreshInterval": 1000,
/* How many seconds until we consider a miner disconnected. */
"minerTimeout": 900,
"ports": [
{
"port": 3333, //Port for mining apps to connect to
"difficulty": 100, //Initial difficulty miners are set to
"desc": "Low end hardware" //Description of port
},
{
"port": 5555,
"difficulty": 2000,
"desc": "Mid range hardware"
},
{
"port": 7777,
"difficulty": 10000,
"desc": "High end hardware"
}
],
/* Variable difficulty is a feature that will automatically adjust difficulty for
individual miners based on their hashrate in order to lower networking and CPU
overhead. */
"varDiff": {
"minDiff": 2, //Minimum difficulty
"maxDiff": 100000,
"targetTime": 100, //Try to get 1 share per this many seconds
"retargetTime": 30, //Check to see if we should retarget every this many seconds
"variancePercent": 30, //Allow time to very this % from target without retargeting
"maxJump": 100 //Limit diff percent increase/decrease in a single retargetting
},
/* Set difficulty on miner client side by passing <address> param with .<difficulty> postfix
minerd -u D3z2DDWygoZU4NniCNa4oMjjKi45dC2KHUWUyD1RZ1pfgnRgcHdfLVQgh5gmRv4jwEjCX5LoLERAf5PbjLS43Rkd8vFUM1m.5000 */
"fixedDiff": {
"enabled": true,
"separator": ".", // character separator between <address> and <difficulty>
},
/* Feature to trust share difficulties from miners which can
significantly reduce CPU load. */
"shareTrust": {
"enabled": true,
"min": 10, //Minimum percent probability for share hashing
"stepDown": 3, //Increase trust probability % this much with each valid share
"threshold": 10, //Amount of valid shares required before trusting begins
"penalty": 30 //Upon breaking trust require this many valid share before trusting
},
/* If under low-diff share attack we can ban their IP to reduce system/network load. */
"banning": {
"enabled": true,
"time": 600, //How many seconds to ban worker for
"invalidPercent": 25, //What percent of invalid shares triggers ban
"checkThreshold": 30 //Perform check when this many shares have been submitted
},
/* Slush Mining is a reward calculation technique which disincentivizes pool hopping and rewards users to mine with the pool steadily: Values of each share decrease in time – younger shares are valued higher than older shares.
More about it here: https://mining.bitcoin.cz/help/#!/manual/rewards */
/* There is some bugs with enabled slushMining. Use with '"enabled": false' only. */
"slushMining": {
"enabled": false, // 'true' enables slush mining. Recommended for pools catering to professional miners
"weight": 120, //defines how fast value assigned to a share declines in time
"lastBlockCheckRate": 1 //How often the pool checks for the timestamp of the last block. Lower numbers increase load for the Redis db, but make the share value more precise.
}
},
/* Module that sends payments to miners according to their submitted shares. */
"payments": {
"enabled": true,
"interval": 600, //how often to run in seconds
"maxAddresses": 50, //split up payments if sending to more than this many addresses
"mixin": 3, //number of transactions yours is indistinguishable from
"transferFee": 5000000000, //fee to pay for each transaction
"minPayment": 100000000000, //miner balance required before sending payment
"maxTransactionAmount": 0, //split transactions by this amount(to prevent "too big transaction" error)
"denomination": 100000000000 //truncate to this precision and store remainder
},
/* Module that monitors the submitted block maturities and manages rounds. Confirmed
blocks mark the end of a round where workers' balances are increased in proportion
to their shares. */
"blockUnlocker": {
"enabled": true,
"interval": 30, //how often to check block statuses in seconds
/* Block depth required for a block to unlocked/mature. Found in daemon source as
the variable CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW */
"depth": 60,
"poolFee": 1.8, //1.8% pool fee (2% total fee total including donations)
"devDonation": 0.1, //0.1% donation to send to pool dev - only works with Monero
"coreDevDonation": 0.1 //0.1% donation to send to core devs - works with Bytecoin, Monero, Dashcoin, QuarazCoin, Fantoncoin, AEON and OneEvilCoin
},
/* AJAX API used for front-end website. */
"api": {
"enabled": true,
"hashrateWindow": 600, //how many second worth of shares used to estimate hash rate
"updateInterval": 3, //gather stats and broadcast every this many seconds
"port": 8117,
"blocks": 30, //amount of blocks to send at a time
"payments": 30, //amount of payments to send at a time
"password": "test" //password required for admin stats
},
/* Coin daemon connection details. */
"daemon": {
"host": "127.0.0.1",
"port": 29081
},
/* Wallet daemon connection details. */
"wallet": {
"host": "127.0.0.1",
"port": 29082
},
/* Redis connection into. */
"redis": {
"host": "127.0.0.1",
"port": 6379
}
/* Monitoring RPC services. Statistics will be displayed in Admin panel */
"monitoring": {
"daemon": {
"checkInterval": 60, //interval of sending rpcMethod request
"rpcMethod": "getblockcount" //RPC method name
},
"wallet": {
"checkInterval": 60,
"rpcMethod": "get_address_count"
}
/* Collect pool statistics to display in frontend charts */
"charts": {
"pool": {
"hashrate": {
"enabled": true, //enable data collection and chart displaying in frontend
"updateInterval": 60, //how often to get current value
"stepInterval": 1800, //chart step interval calculated as average of all updated values
"maximumPeriod": 86400 //chart maximum periods (chart points number = maximumPeriod / stepInterval = 48)
},
"workers": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800, //chart step interval calculated as maximum of all updated values
"maximumPeriod": 86400
},
"difficulty": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"price": { //USD price of one currency coin received from cryptonator.com/api
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"profit": { //Reward * Rate / Difficulty
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
}
},
"user": { //chart data displayed in user stats block
"hashrate": {
"enabled": true,
"updateInterval": 180,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"payments": { //payment chart uses all user payments data stored in DB
"enabled": true
}
}
Your miners that are Windows users can use cryptonote-easy-miner
which will automatically generate their wallet address and stratup multiple threads of simpleminer. You can download
it and edit the config.ini
file to point to your own pool.
Inside the easyminer
folder, edit config.init
to point to your pool details
pool_host=example.com
pool_port=5555
Rezip and upload to your server or a file host. Then change the easyminerDownload
link in your config.json
file to
point to your zip file.
node init.js
The file config.json
is used by default but a file can be specified using the -config=file
command argument, for example:
node init.js -config=config_backup.json
This software contains four distinct modules:
pool
- Which opens ports for miners to connect and processes sharesapi
- Used by the website to display network, pool and miners' dataunlocker
- Processes block candidates and increases miners' balances when blocks are unlockedpayments
- Sends out payments to miners according to their balances stored in redis
By default, running the init.js
script will start up all four modules. You can optionally have the script start
only start a specific module by using the -module=name
command argument, for example:
node init.js -module=api
Example screenshot of running the pool in single module mode with tmux.
Simply host the contents of the website_example
directory on file server capable of serving simple static files.
Edit the variables in the website_example/config.js
file to use your pool's specific configuration.
Variable explanations:
/* Must point to the API setup in your config.json file. */
var api = "http://poolhost:8117";
/* Pool server host to instruct your miners to point to. */
var poolHost = "poolhost.com";
/* IRC Server and room used for embedded KiwiIRC chat. */
var irc = "irc.freenode.net/#forknote";
/* Contact email address. */
var email = "[email protected]";
/* Market stat display params from https://www.cryptonator.com/widget */
var cryptonatorWidget = ["DSH-BTC", "DSH-USD", "DSH-EUR"];
/* Download link to cryptonote-easy-miner for Windows users. */
var easyminerDownload = "https://github.com/zone117x/cryptonote-easy-miner/releases/";
/* Used for front-end block links. */
var blockchainExplorer = "http://chainradar.com/{symbol}/block/{id}";
/* Used by front-end transaction links. */
var transactionExplorer = "http://chainradar.com/{symbol}/transaction/{id}";
/* Any custom CSS theme for pool frontend */
var themeCss = "themes/default-theme.css";
The following files are included so that you can customize your pool website without having to make significant changes
to index.html
or other front-end files thus reducing the difficulty of merging updates with your own changes:
custom.css
for creating your own pool stylecustom.js
for changing the functionality of your pool website
Then simply serve the files via nginx, Apache, Google Drive, or anything that can host static content.
When updating to the latest code its important to not only git pull
the latest from this repo, but to also update
the Node.js modules, and any config files that may have been changed.
- Inside your pool directory (where the init.js script is) do
git pull
to get the latest code. - Remove the dependencies by deleting the
node_modules
directory withrm -r node_modules
. - Run
npm update
to force updating/reinstalling of the dependencies. - Compare your
config.json
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.
No cryptonote based coins have a testnet mode (yet) but you can effectively create a testnet with the following steps:
- Open
/src/p2p/net_node.inl
and remove lines withADD_HARDCODED_SEED_NODE
to prevent it from connecting to mainnet (Monero example: http://git.io/0a12_Q) - Build the coin from source
- You now need to run two instance of the daemon and connect them to each other (without a connection to another instance the daemon will not accept RPC requests)
- Run first instance with
./forknoted --p2p-bind-port 28080 --allow-local-ip
- Run second instance with
./forknoted --p2p-bind-port 5011 --rpc-bind-port 5010 --add-peer 0.0.0.0:28080 --allow-local-ip
- Run first instance with
- You should now have a local testnet setup. The ports can be changes as long as the second instance is pointed to the first instance, obviously
Credit to surfer43 for these instructions
Documentation for JSON-RPC commands can be found here:
- Daemon https://wiki.bytecoin.org/wiki/Daemon_JSON_RPC_API
- Wallet https://wiki.bytecoin.org/wiki/Bytecoin_RPC_Wallet_API
Curl can be used to use the JSON-RPC commands from command-line. Here is an example of calling getblockheaderbyheight
for block 100:
curl 127.0.0.1:18081/json_rpc -d '{"method":"getblockheaderbyheight","params":{"height":100}}'
- To inspect and make changes to redis I suggest using redis-commander
- To monitor server load for CPU, Network, IO, etc - I suggest using New Relic
- To keep your pool node script running in background, logging to file, and automatically restarting if it crashes - I suggest using forever
You need the latest stable version of Forknote for the blockchain explorer - forknote releases
- Add the following code to the coin's config file (important for correct working (this fixed "error polling gettemplate"):
rpc-bind-ip=0.0.0.0
enable-blockexplorer=1
enable-cors=*
- Launch forknoted with the corresponding config file
- Change the following line in the pool's frontend config.json:
var api_blockexplorer = "http://daemonhost.com:1118";
(e.g. var api_blockexplorer ="http://62.75.139.132:39527"; with RPC-Serverport
Then upload file apache2.conf to /etc/apache2 to enable CORS Headers.
- Please start first the dameon and simplewallet (on VPS-Server with the Pool) to create a new pool address (switch with command screen). And start only the daemon on second VPS. Add the pool address to your pool config.json. If you use forknote, then use forknote.exe (Windows) or forknoted (Linux) instead of yourcoind.exe / yourcoind. Then type: killall screen and follow these instruction for Linux:
VPS-Server (1) where is the pool:
Go to your coin-folder (e.g. /home/user/yourcoin)
Type Screen and then:
$ ./yourcoind --config-file configs/yourcoin.conf --log-level 5
Ctrl + A + C (to open new screen tab)
$ ./simplewallet --config-file configs/yourcoin.conf --wallet-file yourwallet --password yourpassword --set_log 5 --wallet-rpc-bind-ip 127.0.0.1 --wallet-rpc-bind-port 8085
Ctrl + A + C
Go to your pool folder (e.g. /home/user/pool)
$ node init.js
VPS-Server (2) for sync the blockchain:
Go to your coin-folder
$ screen
$ ./yourcoind --config-file configs/yourcoin.conf --log-level 5
On local Machine:
Start your Daemon (yourcoind) in Console
Start simplewallet
Create a wallet
Start the Cryptonote-Miner
Stop the Cryptonote-Miner
Add your wallet-address to Cryptonote-Miner folder wallet.address.txt
Edit the config.ini in Cryptonote-Miner folder to your Pool Address and Port
Start Cryptonote Miner again
You can also use CPU-Miner Multi from user tpruvot (supports 32-Bit Systems).
Command to mine in pool (Linux with Properteum Pool Settings): ./cpuminer -o "stratum+tcp://pool.properteum.de:3333" -u yourwalletaddress -p x -a cryptonight -D
(You have to build the miner from source [only Linux] - please follow the build instruction from the developer page). In a few days, we upload a linux/MacOs version.
For windows run in command: cpuminer.exe -o "stratum+tcp://pool.properteum.de:3333" -u yourwalletaddress -p x -a cryptonight -D
- tpruvot - CPU-Miner Multi
Better use forever instead of screen!
- LucasJones - Co-dev on this project; did tons of debugging for binary structures and fixing them. Pool couldn't have been made without him.
- surfer43 - Did lots of testing during development to help figure out bugs and get them fixed
- wallet42 - Funded development of payment denominating and min threshold feature
- Wolf0 - Helped try to deobfuscate some of the daemon code for getting a bug fixed
- Tacotime - helping with figuring out certain problems and lead the bounty for this project's creation
- fancoder - See his repo for the changes
Released under the GNU General Public License v2