HomeAltaCoin

Setup Monero Mining pool using node-cryptonote-pool

Setup Monero Mining pool using node-cryptonote-pool

This a step by step guide on how to setup your own crypto-currency mining pool. This guide is going over how to setup an Monero mining pool . This is meant to setup a mining pool for a SINGLE CRYPTO CURRENCY. This is not a guide for a Multipool!!!!

If you want to see what it looks like before you set it all up, head to the Monero Mining Pool.

For this guide purpose I will be using Monero Crypto Currency .

Requirements

 

Setup

At this point you should have your VPS started, putty up and running and your logged in as root.

Update Ubuntu

apt-get update
apt-get dist-upgrade

Setup SWAP

I am setting up a 4GB swap, which may be overkill but it’s the most common swap sized used in most guides so ill keep it at that.

dd if=/dev/zero of=/mnt/myswap.swap bs=1M count=4000
mkswap /mnt/myswap.swap
swapon /mnt/myswap.swap

Now let’s add it into fstab so it’ll activate at boot.

nano /etc/fstab

Add the following line at the end of the file.

/mnt/myswap.swap none swap sw 0 0

Ctrl+O to save, and Ctrl+X to exit the nano editor.

Now your swap is setup, you can modify the size in the future if you need more or less.

Install Required Packages

apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server
add-apt-repository ppa:bitcoin/bitcoin
apt-get update
apt-get install libdb4.8-dev libdb4.8++-dev
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

 

Monero Daemon Setup (Wallet)

Now let’s setup the coin daemon, I will be using monero.

Now boot up putty .

We download a prebuilt version Monero from there offilcail site here:

https://downloads.getmonero.org/cli/monero-linux-x64-v0.11.0.0.tar.bz2

cd
mkdir monero
cd monero
wget https://downloads.getmonero.org/monero.linux.x64.v0-10-1-0.tar.bz2
tar -xjvf monero-linux-x64-v0.11.0.0.tar.bz2
ls

After issuing “ls” you will see many files are in the directory. you need to start demon now so that it will start sync to blockchain network

./monerod

You can see demon is starting and you can see that it started syncing with network . Depend on your vps network speed it will take some time to fully sync .

** On the other hand we can do this sync process faster by using this command so what ever you like you can do it

-- Fastest way to synchronize the daemon

The fastest way to achieve this, is to download the current blockchain and import it into the daemon.

First download it;
wget -c --progress=bar https://downloads.getmonero.org/blockchain.raw

If it fails half-way, just re-run it. The above command will continue where it left off.

Finally import it into the daemon by running;
./monero-blockchain-import --verify 0 --input-file ./blockchain.raw

Do remember though, run with --verify 0 only from a trusted source like above.

When it finishes u can safely remove the *.raw file;
rm -rf ./blockchain.raw

Now we need to verify and link to moneno network to current state

./monerod

You can see all list of detail and showing that it connect to network success message ..

now

exit

you need to use exit command so that it will save the sync done otherwise you have to again do the sync process

Finally start the monero daemon, which most likely, u will want running in detached/background mode;
./monerod --detach

Mining Pool Setup

We will use node-cryptonote-pool to setup the pool and front end site.

  1. Downloading and Installing

Clone the repository and run npm update for all the dependencies to be installed:

cd
git clone https://github.com/zone117x/node-cryptonote-pool.git pool
cd pool
npm update

Once the above process done we need to copy the  config_example.json to active configuration to so your pool start working

cp config_example.json config.json

This will copy all default config file data to active config file “ config.json

2. Configuration

Warning for Cyrptonote coins other than Monero: this software may or may not work with any given cryptonote coin. Be wary of altcoins that change the number of minimum coin units because you will have to reconfigure several config values to account for those changes. Unless you’re offering a bounty reward – do not open an issue asking for help getting a coin other than Monero working with this software.

Now start up the wincp and put your root login detail to start up once done head over to

/root/pool folder and right click on config.json and edit now you can see all config detail as per below mention and you can edit as per your need .

Explanation for each field:

/* Used for storage in redis so multiple coins can share the same redis instance. */
“coin”: “monero”,

/* Used for front-end display */
“symbol”: “MRO”,

“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”: “4AsBy39rpUMTmgTUARGq2bFQWhDhdQNekK5v4uaLU699NPAnx9CubEJ82AkvD5ScoAZNYRwBxybayainhyThHAZWCdKmPYn”

/* 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
},

/* 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
},
/* [Warning: several reports of this feature being broken. Contributions to fix this are welcome.]
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 */
“slushMining”: {
“enabled”: false, //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
“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 – only works with Monero
},

/* 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”: 18081
},

/* Wallet daemon connection details. */
“wallet”: {
“host”: “127.0.0.1”,
“port”: 8082
},

/* Redis connection into. */
“redis”: {
“host”: “127.0.0.1”,
“port”: 6379,
“auth”: null //If set, client will run redis auth command on connect. Use for remote db
}

3. [Optional] Configure cryptonote-easy-miner for your pool
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.

4. Start the pool
node init.js

This will show all running and start accepting share for your pool

we need to now install forever so that this pool will remain running even on close of ssh

npm install forever -g

once installation done final start the pool

forever start init.js

Example screenshot  of running the pool in single module mode with tmux.

5. Host the front end 

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”;

/* Minimum units in a single coin, for Bytecoin its 100000000. */
var coinUnits = 1000000000000;

/* Pool server host to instruct your miners to point to. */
var poolHost = “cryppit.com”;

/* IRC Server and room used for embedded KiwiIRC chat. */
var irc = “irc.freenode.net/#monero”;

/* Contact email address. */
var email = “support@cryppit.com”;

/* Market stat display params from https://www.cryptonator.com/widget */
var cryptonatorWidget = [“XMR-BTC”, “XMR-USD”, “XMR-EUR”, “XMR-GBP”];

/* 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. For other coins it can be changed, for example with
Bytecoin you can use “https://minergate.com/blockchain/bcn/block/”. */
var blockchainExplorer = “http://monerochain.info/block/”;

/* Used by front-end transaction links. Change for other coins. */
var transactionExplorer = “http://monerochain.info/tx/”;

6. Customize your website

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:

  1. custom.css for creating your own pool style
  2. custom.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.

Congratulations You have now your own Monero Mining Pool Ready to Start

If you liked this guide, please donate to me as well!

Donations

BTC: 18xRnsa828YALPgbvjRXQuQ63QqikPbKxq

  • monero

    Thanks for the tutorial…

    • vicky

      what services does run when running a pool beside monerod?
      should monero-wallet-rpc run too?

  • Hey, nice guide. I followed this roughly but when I do an “npm update” it tells me that cryptonote-util doesn’t exist in GitHub anymore.

    Any ideas?

    Thanks

    • same error here… do you fix it?

  • zamzara

    config autopay (monero-wallet-rpc) pleace

  • Minero

    Thanks for the tutorial… Quick question: is it possible to setup an ETH and a Monero pool on the same VPS?

    Thanks.

  • Dhaval

    how can i identify which is my poolAddress ?

    • testapazza

      Hi, have a solution?

  • joe

    How to configure and display the frontend
    I have followed the guidelines but failed
    I use ubuntu desktop 14.04

  • Isa

    This is very useful for Monero mining. I have been blogging about Monero too.

  • Cedric

    I get following message when trying to connect to my server

    “[2017-09-23 14:39:28] Stratum connection failed: Failed to connect to “ipadress” port 3333: Connection refused”

    I’ve done an ufw on the port but nothing seems to work.

    • this because you pool is not running login to user using whic you install the pool and then pass this command

      node init.js

      • Cedric

        I did the node init.js command, but that gives erros as well. But you’re speaking about something else I need to install. can you give me the command of that?

  • tommy

    Hello

    thanks for the guide by the way, I’m currently synching the blockchain but have a few questions please:

    1.does the monero daemon not have to be set to run forever as well with this for it to keep the blocks updated?

    2. most guides say to bind the redis in the conf file and firewall it. I cant find the redis stuff anywhere but can see that we install a redis-server package, can you offer any advice on securing it in your guide please?

    cheers

    • 1.does the monero daemon not have to be set to run forever as well with this for it to keep the blocks updated?
      –>> just through the monero demon in new screen and keep the screen as it and leave putty and it will run fever or use monero detach command to run it

      2. most guides say to bind the redis in the conf file and firewall it. I cant find the redis stuff anywhere but can see that we install a redis-server package, can you offer any advice on securing it in your guide please?
      –>> its already configured in the config file with default setting redis not need to woory about it pool software will do all thing

      • tommy

        Hello

        thanks for the answers, massively appreciated.

        so if I use the run “detach” command then it will stay running even if I exit putty?

        does this also apply to the monero-wallet-cli – do i have to run this detached for auto payments to work?)

  • martin

    Hello

    How does the pool send payments please? does the pool software not require the password to be stored somewhere or does the wallet simply need to be running on the server so it can handle this?

    Thanks

  • Cedric

    when I launch “node init.js” I get following error spaming

    Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:435:18)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at bindings (/home/username/pool/node_modules/bindings/bindings.js:81:44)
    at Object. (/home/username/pool/node_modules/multi-hashing/index.js:1:99)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    2017-09-25 19:36:27 [master] Pool fork 4 died, spawning replacement worker…

    what am I doing wrong? And I guess that’s why my workers can’t connect to my server.

    • Just delete the pool folder reinstall only pool software and it will be solved

      • Cédric Dufour

        this is what I get as error now
        $ cd pool
        $ npm update

        > bignum@0.12.5 install /home/pooldaemon/pool/node_modules/bignum
        > node-pre-gyp install –fallback-to-build

        /usr/bin/env: ‘node’: No such file or directory
        cryptonote-pool@0.0.1 /home/pooldaemon/pool
        ├── async@1.5.2
        ├── cli-color@1.1.0
        ├── cryptonote-util@0.0.3 (git://github.com/Snipa22/node-cryptonote-util.git#49d6ec72d499bba9144d4a3ebdf4b62a4262aa8a)
        ├── dateformat@1.0.12
        ├── multi-hashing@0.0.9 (git://github.com/zone117x/node-multi-hashing.git#73996fe77104108f2d66ef750b3e1bce42e4d8f0)
        └── redis@0.12.1

        npm ERR! Linux 4.4.0-97-generic
        npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “update”
        npm ERR! node v4.2.6
        npm ERR! npm v3.5.2
        npm ERR! file sh
        npm ERR! code ELIFECYCLE
        npm ERR! errno ENOENT
        npm ERR! syscall spawn

        npm ERR! bignum@0.12.5 install: `node-pre-gyp install –fallback-to-build`
        npm ERR! spawn ENOENT
        npm ERR!
        npm ERR! Failed at the bignum@0.12.5 install script ‘node-pre-gyp install –fallback-to-build’.
        npm ERR! Make sure you have the latest version of node.js and npm installed.
        npm ERR! If you do, this is most likely a problem with the bignum package,
        npm ERR! not with npm itself.
        npm ERR! Tell the author that this fails on your system:
        npm ERR! node-pre-gyp install –fallback-to-build
        npm ERR! You can get information on how to open an issue for this project with:
        npm ERR! npm bugs bignum
        npm ERR! Or if that isn’t available, you can get their info via:
        npm ERR! npm owner ls bignum
        npm ERR! There is likely additional logging output above.

        npm ERR! Please include the following file with any support request:
        npm ERR! /home/pooldaemon/pool/npm-debug.log

        I tried as mentioned above to install the bignum thing but no luck. any idea what the f… I am doing wrong?

        • sumit pradhan

          this because you have not installed lastes version of node.js and npm installed. and not properly activated

          • Cédric Dufour

            I did
            -sudo apt-get remove nodejs
            -sudo apt-get update
            -sduo apt-get install nodejs
            -sudo apt-get install npm
            then cd into my pool folder and ran “npm updat” now this the error I get
            $ npm update

            > bignum@0.12.5 install /home/pooldaemon/pool/node_modules/bignum
            > node-pre-gyp install –fallback-to-build

            /usr/bin/env: ‘node’: No such file or directory
            cryptonote-pool@0.0.1 /home/pooldaemon/pool
            ├── async@1.5.2
            ├── cli-color@1.1.0
            ├── cryptonote-util@0.0.3 (git://github.com/Snipa22/node-cryptonote-util.git#49 d6ec72d499bba9144d4a3ebdf4b62a4262aa8a)
            ├── dateformat@1.0.12
            ├── multi-hashing@0.0.9 (git://github.com/zone117x/node-multi-hashing.git#73996 fe77104108f2d66ef750b3e1bce42e4d8f0)
            └── redis@0.12.1

            npm ERR! Linux 4.4.0-97-generic
            npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “update”
            npm ERR! node v4.2.6
            npm ERR! npm v3.5.2
            npm ERR! file sh
            npm ERR! code ELIFECYCLE
            npm ERR! errno ENOENT
            npm ERR! syscall spawn

            npm ERR! bignum@0.12.5 install: `node-pre-gyp install –fallback-to-build`
            npm ERR! spawn ENOENT
            npm ERR!
            npm ERR! Failed at the bignum@0.12.5 install script ‘node-pre-gyp install –fall back-to-build’.
            npm ERR! Make sure you have the latest version of node.js and npm installed.
            npm ERR! If you do, this is most likely a problem with the bignum package,
            npm ERR! not with npm itself.
            npm ERR! Tell the author that this fails on your system:
            npm ERR! node-pre-gyp install –fallback-to-build
            npm ERR! You can get information on how to open an issue for this project with:
            npm ERR! npm bugs bignum
            npm ERR! Or if that isn’t available, you can get their info via:
            npm ERR! npm owner ls bignum
            npm ERR! There is likely additional logging output above.

            npm ERR! Please include the following file with any support request:
            npm ERR! /home/pooldaemon/pool/npm-debug.log

            I’m getting the feeling I’m running in circles here lol

          • sumit pradhan

            if you can share you ssh detail i can see if any problem or i can try to solve it .. you can mail at hello@betbybitcoin.com

  • Kyl

    Im getting the same error as above:

    /root/pool/node_modules/bindings/bindings.js:88
    throw e
    ^

    Error: Module did not self-register.
    at Error (native)
    at Object.Module._extensions..node (module.js:434:18)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at bindings (/root/pool/node_modules/bindings/bindings.js:81:44)
    at Object. (/root/pool/node_modules/multi-hashing/index.js:1:99)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    2017-10-01 08:47:37 [master] Pool fork 1 died, spawning replacement worker…

    • When you getting this error ??

      • James -TheMrPopper69

        on ‘node init.js’ I have the same

        • sumit pradhan

          reinstall the pool software again

  • Kyl

    Alright, not sure exactly what I did. So somehow I think node.js switched back out of 0.10.25 (I needed to revert to this in order to to build originally), and thus I believe is why it was throwing the above error. I ran again:
    nvm install 0.10.25
    nvm use 0.10.25
    npm update

    And then I had a bignum error which was simply resolved via:
    npm install bignum..

    All working!! Much thanks for this tutorial:
    017-10-01 09:09:17 [api] Stat collection finished: 95 ms redis, 90 ms daemon
    2017-10-01 09:09:17 [api] Broadcasting to 0 visitors and 0 address lookups
    2017-10-01 09:09:17 [pool] (Thread 1) New block to mine at height 1410992 w/ difficulty of 29294505751
    2017-10-01 09:09:17 [pool] (Thread 1) Started server listening on port 3333
    2017-10-01 09:09:17 [pool] (Thread 1) Started server listening on port 5555
    2017-10-01 09:09:17 [pool] (Thread 1) Started server listening on port 7777
    2017-10-01 09:09:17 [pool] (Thread 1) Started server listening on port 8888
    2017-10-01 09:09:17 [pool] (Thread 2) New block to mine at height 1410992 w/ difficulty of 29294505751
    2017-10-01 09:09:17 [pool] (Thread 2) Started server listening on port 3333
    2017-10-01 09:09:17 [pool] (Thread 2) Started server listening on port 5555
    2017-10-01 09:09:17 [pool] (Thread 2) Started server listening on port 7777
    2017-10-01 09:09:17 [pool] (Thread 2) Started server listening on port 8888

    • Great that our guide help you

  • David Vos
    • sumit pradhan

      the port 5555 is not open in server firewall

    • sumit pradhan

      Do your pool hit block

      • David Vos

        Yes, I have it synced and everything, my time isnt correct tho, i need to fix that?

        • sumit pradhan

          what is your pool address

    • sumit pradhan

      Your port is not opened please open the port and then try

  • egemen ergel

    how can use wallet.WorkerID with this pool software

    • sumit pradhan

      Right now the software don’t allow to use that once the dev add the option it will have it

  • make: Leaving directory ‘/root/pool/node_modules/multi-hashing/build’
    npm ERR! cryptonote-util@0.0.3 install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the cryptonote-util@0.0.3 install script.
    npm ERR! This is most likely a problem with the cryptonote-util package,

    Do you know how can i fix?

    • sumit pradhan

      npm is not installed may be properly have you done this step without any error

      apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev

      apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server

      add-apt-repository ppa:bitcoin/bitcoin

      apt-get update

      apt-get install libdb4.8-dev libdb4.8++-dev

      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

    • sumit pradhan

      its not for make to work ..there is something differ problem may be not sure