Setting up a Monero node with solo mining pool


What is Monero?

Monero (XMR) is one of multiple new cryptocurrencies with its own blockchain network. You can participate in this network by setting up a node which synchronizes with the global distributed blockchain and let it run to strengthen the network. The official sources are available at getmonero.org, bundled with a wallet application that lets you create and manage your wallet.

Monero advertizes itself with its privacy feature that hides transactions on the blockchain. Normally, as in Bitcoin, the whole network knows about every transactions sender and receiver. These are hidden in Monero, made possible by a ring signature algorithm which obfuscates sender, receiver and amount. To enable verification of transactions and wallets, Monero uses Transaction IDs and Wallet View Keys.

Despite all the cool sounding features, I chose to play with Monero primarily because of its blockchain algorithm, CryptoNote. In comparison to hash-based algorithms like the one Bitcoin uses, CryptoNote not only uses CPU but also system memory for mining. It is therefore still feasible to mine on ordinary CPUs. My main aim of experimentation was stress testing a new system, so a combination of testing and learning something new offered itself.

Installing a Monero node

A node participates in the blockchain network of Monero. After compiling and starting up it connects to some other nodes and synchronizes its database. This took me about 9 hours, the last 5% were the worst. In the forums you might read it helps to have fast disks, but from my experience it does not bring the node down if you put the database on a HDD instead of a SSD. The node runs with 4 GB of RAM and two CPU cores, the database grows to about 19 GB (at a height of ~1330000).

The compilation of the node from official sources requires some dependencies, which are all available from the repos in Debian. After compilation, you start the node with ./monerod in the bin folder. You should also create a wallet and note its address.

Opening the Stratum pool

To contribute to the network by offering processing time – aka mining – you can either mine for yourself or participate as a member in a pool of miners. Some pools are public, you can find one at moneropools.com.

If you decide to participate in a pool, you connect to it with your client, get a part of the work that has to be done and process it. This way the processing power of all participants of the pool is combined and a newly mined block is found a lot faster. The compensation in form of Moneroj is then divided between all members, minus the pool fee.

Because I want to mine solo, but use an external miner that connects to a pool (to not have to share the machine between the node and the miner), I chose to set up the monero-stratum solo mining pool on the machine that already hosts the node. The two exchange information over IPC channels on the localhost.

The pool also needs the Monero sources, together with a Golang compiler. It is also important to compile it with cmake -DBUILD_SHARED_LIBS=1 . or Go won't be able to include the needed libraries.

After compilation the pool needs your wallet address inside the config.json, other configuration options are also available. See section „configuration“. If everything works you can check the web frontend and should see a running pool with 0 miners.

Connecting mining workers to the pool

Now we have a synced Monero node running, a wallet set up and a pool waiting for miners to connect.

The miner I used in this experiment was the xmr-stak-cpu miner. It is built for use with CPU, there are alternatives for GPUs. Compile this one also and you are good to go.

Once compiled, start the miner and it will figure some fitting config.txt for your system. Keep an eye on the threads count, it should match your real CPU core count, not the available threads count. Intel i7 offer Hyperthreading which enables two threads per CPU core. Also put in your wallet and configure the pool connection settings.

Start the miner with ./xmr-stak-cpu config.txt and you can see a new miner appearing in the pool. Your most important processing power indicator is the H/s value which is Hashes per Second. Don't be surprised if the value seems low compared to other cryptocurrencies, a value from 300 to 700 H/s is a good middle field in CPU benchmarks.

In conclusion I got to test the whole setup in one day, which was a nice surprise after I saw the first time estimations the synchronization spit out. Of course my processing power did not result in any form of compensation, but since the mining itself took the least time in the whole process this is not a surprise. In fact, would I go into mining Monero myself, I would likely join a public pool. Either way, it is good to experiment – especially in such a young field like cryptocurrencies.

Happy mining!