Skip to content
mvis edited this page Aug 4, 2017 · 8 revisions

Setting Up a Node

TL;DR

  • Start Parity with ...
parity[.exe] --jsonrpc-hosts all --jsonrpc-interface all --stratum --stratum-interface=0.0.0.0 --author 0x...
  • This will configure Parity for Open RPC. Consider using Closed RPC if you can.
  • Consider adding --extra-data "...; MVis" to advertise that you're using Mining Visualizer.

Introduction

In order to solo mine, your miner needs to be in communication with a node in order to receive work packages, and to submit solutions when you mine a block. The two most common nodes are Parity and Geth. If you have a small mining farm, either will do, but if you have more than 2 or 3 mining rigs you should definitely use Parity due to its support for the stratum protocol.

You don't need a high-powered PC to run a node -- any regular computer will do. It is actually quite feasible to run a node on one of your mining rigs. However, it is strongly recommended to install an SSD hard drive to store the blockchain in order to get the best performance.

Configuration instructions will be presented below for Parity, with a detailed explanation of command line options. Only the bare minimum commands will be discussed. For full details on Parity configuration please visit the wiki.

For Geth, please see the configuration page on their wiki. The specific command syntax will be different, but the concepts are the same.

Installing

Download and install Parity using the link above. On Windows, it usually launches automatically as part of the install process. Otherwise you will need to start it manually. If you plan on mining on the Ethereum Classic (ETC) chain, and Parity has already started, you will need to stop it and add the command line flag --chain classic so it downloads the right chain.

Once it has finished downloading the blockchain, stop it and create a batch file / script with the necessary command line paramaters, as described in the following sections.

JSON-RPC

The miner program needs to communicate with the node using JSON-RPC, even if you plan to use stratum. JSON-RPC is enabled by default on port 8545, so no action is required unless you want to use a non-default port number. The necessary CLI flag for that is --jsonrpc-port 12345. Using a non-default port number is highly recommended if you are running Open RPC, as it provides an extra layer of security.The maximum port number you can choose is 65535.

If the node and the miner are on the same computer, it is highly recommended to configure Closed RPC, whereby the node will only accept connections from the local machine. This is accomplished by adding --jsonrpc-cors localhost to the command line.

If, on the other hand, the node needs to be accessed by miners running on other computers, you will need to configure Open RPC, by adding --jsonrpc-hosts all --jsonrpc-interface all to the command line. Note that this does present a security risk, but you can largely mitigate it by making sure your node is behind a properly configured firewall, router or other security device. Also, as mentioned above, using a non-standard port number helps significantly.

Firewall Ports

On Windows at least (possibly other operating systems as well), you will most likely need to manually add firewall rules to open up the necessary TCP ports, otherwise your miners will not be able to communicate with your node.

The following points may be helpful:

  • Control Panel Applet : Windows Firewall with Advanced Security
  • Create a new Inbound Rule
  • Programs and Services : specify the Parity executable
  • Protocol : TCP
  • Local Port : either enter the specific port you chose above, or for more relaxed security, specify "All Ports"
  • Remote Port : All Ports

Mining Rewards

The CLI flag --author 0x... sets the Ethereum account address that mining rewards will be sent to when you mine a block.

Stratum vs getWork

As mention above, the miner needs to be in communication with a node in order to receive work packages, which basically contain some hashes describing the block that needs to be mined. The default method of obtaining these packages is for the miner to poll the node repeatedly. The default is once every 200 milliseconds. This is often referred to as getWork. That's fine if you only have 1 or 2 miners, but any more and you start putting a significant resource strain on the node.

A better way is to use the Stratum protocol, whereby the miner registers with the node and then waits for it to send notification messages regarding new work packages. At the time of this writing, this protocol is only available with Parity. To activate this protocol, add the CLI flag --stratum to your command line. The default port is 8008.

Extra Data

I have made the Mining Visualizer suite of programs available to the Ethereum community free of charge as open source software, and while I am open to donations, I expect nothing else in return. I do, however, derive some gratification in knowing that people are using this software. One way that you can flag this is by adding the string "MVis" to the extra-data field, using the CLI flag --extra-data STRING. Whenever you mine a block, this string will be inserted into the block that then becomes part of the blockchain. The default value of this field is usually just the name and version of the node. One suggestion would be to set it to --extra-data "Parity/vx.x.x; MVis", where x.x.x is the version of Parity that you are running. You could, of course, set it to something more personal. For Geth, the extra data field is set via --extradata STRING.

Clone this wiki locally