Skip to content

How to mine RNG Beta2 EN

strict-9 edited this page Jun 6, 2019 · 7 revisions

Table of Contents

  • Hardware Requirements
  • Environment Configuration
    • Linux
    • MacOS
    • Windows
  • Deployment
  • Run
  • Request for test currency
  • Create a deposit contract
  • Management and Maintenance

Hardware Configuration

  • Recommended: 4 core CPU, 8GB RAM, 200GB storage, public IP or URL (optional)
  • Minimum: 2 core CPU, 2GB RAM, 100GB diskspace, public IP or URL (optional)

Environment Configuration

Linux(Ubuntu 18.04)

Install prerequisite packages

Open a terminal session and execute the following command:

sudo apt install curl make g++

Installing Node.js

Open a terminal session and execute the following commands:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

After the installation is complete, enter the following commands in the terminal to check the installation results:

node -v
npm -v

Install git

sudo apt-get install git

Install sqlite

sudo apt-get install sqlite3

Install pm2

sudo npm install pm2 -g

After the installation is complete, enter the following command to check if the installation was successful:

pm2 --version

MacOS

Install Node.js

Download the official Mac installation package: node-v8.15.1.pkg

After the installation is complete, enter the following command in the terminal to check the installation results:

node -v
npm -v

Install git

The system usually comes bundled with git and does not need to be installed. However, if the git command cannot be executed, please follow the system prompts to complete the installation.

Install sqlite

Again, the system comes bundled with it, and should not need to be installed.

Install pm2

Execute the following command in the terminal:

sudo npm install pm2 -g

Windows

Install Node.js

Download the official Windows installation package: node-v8.15.1-x64.msi

Install git

Download the official Windows installation package: Git

Install Compilation Tools

Open a PowerShell terminal as an administrator and execute the following command:

npm install --global --production windows-build-tools

This command installs Python 2.7 and Visual Studio Build Tools 2017. After the installation is successful, configure npm:

npm config set msvs_version 2017

Open the Windows Environment Variables dialog by executing the following command:

rundll32 sysdm.cpl,EditEnvironmentVariables

Add the following variable, and then add Python2.7 to the PATH variable:

  • GYP_MSVS_VERSION = 2017
  • Add the Python2.7 installation directory "%HOMEPATH%.windows-build-tools\python27" to the PATH variable

Install sqlite

Visit the sqlite website: www.sqlite.org/download.html

Download the two zipped packages: sqlite-dll and sqlite-tool

Extract the two packages, as an administrator, into the "C:\WINDOWS\system32" folder.

Install pm2

Run "git bash" as an administrator and execute the following command:

npm install pm2 -g

SuperNode Deployment

The following deployments and configurations are platform independent and the same across operating systems. Windows systems can execute the commands in "git bash".

Download the SuperNode program

https://github.com/ringnetwork/rng-supernode

git clone https://github.com/ringnetwork/rng-supernode.git

Install the wallet (optional)

The purpose of installing the wallet is to associate the deposit security and Coinbase addresses with the wallet address. This will facilitate the observation of mining revenue, and ensure the safety of SuperNode's funds.

  1. Download the wallet at https://github.com/ringnetwork/rng-wallet/releases    - For now the wallet is only available for Windows. Note: When the wallet is first launched, make sure to select the full account mode so it downloads the complete ledger, otherwise it will not be able to trade.
  2. Follow the wallet prompts, save your mnemonic seed, as well as take note of your device address and wallet address    - Where to find your Device Address: Go to the wallet main page -> Click "wallet" in the lower-right corner -> Click on the upper-right corner of the wallet page to enter the "Settings" page -> then you will find your device address.

Changing the SuperNode configuration file

  1. Enter the SuperNode directory:
cd ./rng-supernode
  1. Edit conf.js using your preferred editor.    - Set your IP address and port to let other nodes discover you:
exports.port = xxxx;//your local open port
exports.myUrl = 'ws://IP or URL: xxxx';//your public IP or URL: your public network port

   - (optional) Assign device address to exports.safe_device_address:

exports.safe_device_address = "your device address";

   - (optional) Assign wallet address to exports.safe_address:

exports.safe_address = "Your App Wallet Address";

   - (optional) Assign wallet address to exports.coinbase_address:

exports.coinbase_address = "your wallet address"; / / can be different from safe_address

   - Note: Double quotes must be added before and after the device address

  1. Confirm the result of the modification
cat ./conf.js

Example of a modified conf.js:

/*jslint node: true */
"use strict";

/**
 *      for version control
 */
exports.clientName              = 'supernode-horsen';
exports.minClientVersion        = '1.1.0';


exports.WS_PROTOCOL = 'ws://';
// https://console.developers.google.com
exports.pushApiProjectNumber = 0;
exports.pushApiKey = '';

exports.port = 9193;
exports.myUrl = 'ws://119.28.213.23:9193';
exports.bServeAsHub = true;
exports.bSaveJointJson = true;
exports.bLight = false;
exports.bServeAsRpc = true;
exports.rpcInterface = '127.0.0.1';
exports.rpcPort = 6553;
exports.debug = false;


// byzantine
exports.IF_BYZANTINE = true;

// this is used by wallet vendor only, to redirect bug reports to developers' email
exports.bug_sink_email = 'admin@example.org';
exports.bugs_from_email = 'bugs@example.org';

exports.HEARTBEAT_TIMEOUT = 300*1000;

exports.initial_peers = [
    "ws://119.28.44.246:9193",
];

exports.storage = 'sqlite';

exports.deviceName = 'Supernode';
exports.permanent_pairing_secret = 'randomstring';

// change the address to your own
exports.safe_address = "VWQ3WFTSUSVODREJASHZSHGWIZRUP6GV"; //Your wallet address
exports.safe_device_address = "0RSXLDX5GVTK73KXXAK4LSJWWVB72EI52"; //Your device address, found in wallet settings
exports.coinbase_address = "VWQ3WFTSUSVODREJASHZSHGWIZRUP6GV"; //Your wallet address can be different from safe_address


exports.bSingleAddress = true;
exports.THRESHOLD_DISTANCE = 6;
exports.MIN_AVAILABLE_WITNESSINGS = 100;
exports.bPostTimestamp = false;

exports.start_mining_round = 0;
exports.maxWorkderCount = 0;

exports.KEYS_FILENAME = 'keys.json';

console.log('finished witness conf');

Install dependencies

It is recommended to install the dependencies with domestic images:

npm install

It takes about several minutes depending on the network.


Start SuperNode

Start SuperNode with pm2 and run it in the background:

pm2 start start.js --name supernode

After the startup is successful, check the running log. (For more on how to use pm2, see their quick-start guide)

pm2 logs supernode

You can see the SuperNode address in the log, such as:

...
Wed Apr 03 2019 16:00:35 GMT+0800 (CST): To release the terminal, type Ctrl-Z, then 'bg'
Wed Apr 03 2019 16:00:35 GMT+0800 (CST): my address: FAXUS4CYZNXE4EQDFOGOXT33IGHBX3SY
...

In the log, FAXUS4CYZNXE4EQDFOGOXT33IGHBX3SY is the SuperNode address. The SuperNode address can receive tokens for creating a deposit contract.

Enter your "public network IP / URL: port" in the browser. If you can see information such as "Upgrade Required" then network communication is working.


Apply for test coins

  1. Add WeChat: “RNG Privacy Coin Angel” and apply to join the mining discussion group.
  2. After joining the mining group, send your SuperNode address and myUrl to receive the test currency.
  3. Follow the next steps to create a deposit contract to enable mining.

Create a deposit contract

  1. Bill the SuperNode address and wait for the SuperNode to receive the token (about 10 seconds).
  2. Keep the SuperNode running, open a new terminal locally on the SuperNode or create a new SSH connection to the SuperNode, and then execute the following command in the new terminal:
curl --data '{"jsonrpc":"2.0", "id":1, "method":"createMinerAddress", "params":[1000000] }' http://127.0.0.1:6553

Among them, 1000000 is the amount of the deposit contract, the value cannot be 0, and cannot be greater than the amount of money to the SuperNode address.

If the deposit contract is created successfully, it will return the following format:

{"jsonrpc":"2.0","result":"W3MMU32YURN6XISK5YADI4QQXKRH5INK","id":1}

Among them, "W3MMU32YURN6XISK5YADI4QQXKRH5INK" is the deposit contract address of the SuperNode.

After the deposit contract is successfully created, the SuperNode will start the mining process after the balance of the book is over. The prompt information and meaning are as follows:

  • Start Mining -- Mining has started
  • Mining Success -- Successful mining
  • Coinbase Reward -- Get mining rewards If you can see the mining reward in the wallet, the SuperNode node is deployed normally.

You can pay more Tokens to the SuperNode deposit contract, reducing the PoW difficulty.


SuperNode Management & Maintenance

Data Storage Directory Locations

Linux:

~/.config/rng-supernode/

MacOS:

~/Library/Application Support/rng-supernode/

Windows:

%LOCALAPPDATA%\rng-supernode

Super Node data files:

  • keys.json: key file containing the mnemonic of the SuperNode
  • log.txt: log file for the mining program
  • *.sqlite: database files

Wallet App Data Directory

Linux:

~/.config/rng-wallet-beta2/

MacOS:

~/Library/Application Support/rng-wallet-beta2/

Windows:

%LOCALAPPDATA%\rng-wallet-beta2

Updating the SuperNode software

Go to the SuperNode program directory and execute:

git pull

Then, update the dependency package:

npm install

In this way the conf.js file is not overwritten, and there is no need to reconfigure the SuperNode network, secure address, and Coinbase address.

Query mnemonic

Enter the data directory, open the key.json file directly with the editor of this article, or view the file in the terminal.

cat key.json

Quickly check network connections with log files

tail -f log.txt | grep connection

Example of execution results:

Mon Apr 08 2019 16:43:09 GMT+0800 (CST): 13 incoming connections,
12 outgoing connections,
0 outgoing connections being opened

RPC interface

For more information on SuperNode management and maintenance, see Super Node RPC.

Clone this wiki locally