How to Launch Color Node

This document explains how to install and launch a validator node in Color Platform Mennet-beta network using utility scripts.

PLEASE NOTE: running validator node creates significant load on CPU. A computer with 2 cpu cores can run only one node. A computer with 4 cores should run no more than 2 validator nodes. Consider running 3 nodes only on computers with multi-core server CPU.

If unsure, install just 1 node.

 

Prerequisites

Install the Software

Download and unpack utility scripts

Install the beta binaries and create configuration files for validators.

Configure the Software

Allocate beta coins

Open Ports in Firewall

Launch the Nodes

Check that the nodes do run

Creating the Validator

Prerequisites

Create Validators

Unsuspending

Restart and Update

Restart nodes

Update the software

Prerequisites

Color node runs on Linux. In order to launch it you need either:

Another requirement is that the box where Color node is running, must have a globally routable IP address (or “static” IP address). Most network providers hide the IP addresses of their clients using NAT technology. Therefore, special steps could be required to allocate such an address.

Please make sure that you have an SSD drive, if you plan to run more than one validating nodes. Delays on disk writes may hamper the performance of your node.

Please make sure you have enough free space on your dive. Single color node consumes up to 15 GB of drive storage for various databases and indexes.

Windows Subsystem for Linux

WSL is a package of Linux system calls that allows running virtually all Linux software in Microsoft Windows. To activate WSL in Windows 10 please follow the instructions from Microsoft site: https://docs.microsoft.com/en-us/windows/wsl/install-win10

The example commands below are for Ubuntu Linux flavour. You can install Ubuntu for WSL from Microsoft Store 

Install the Software

Remove previous installation

If you participated in the previous Beta of the Color Platform Mainnet, please remove it before proceeding with the installation.

To do so use the following commands:

        Stop the running instances:

        ./color/scripts/90-stop-nodes.sh

        Remove all data files, executables and scripts

        rm -rf ./color/

Download and unpack utility scripts

curl https://mainbeta-3.color-platform.org/nodes/color-scripts.tgz|tar xfz -

These commands will create directory color/scripts in the current directory.

Install the beta binaries and create configuration files for validators.

  1. Install the required system utils: jq and perl.

In Debian/Ubuntu systems:

sudo apt install jq perl -y

For other systems please refer to the manual.

  1. Review the settings in color/scripts/00_settings.json:
  1. Open the file with settings:

nano color/scripts/00_settings.sh

  1. By default the scripts install binaries and all data to ~/color/mainbeta-3. If you want to use another location, edit the value of COLOR_DIR_DEFAULT variable.

Press Ctrl-O to write changes.

  1. Press Ctrl-X to exit
  1. Launch the installation script:

 ./color/scripts/10-init-nodes.sh

The script:

  1. Erases the ~/color/mainbeta-3 directory.
  2. Then it asks how many nodes you want to run, from 1 to 5. Please note that running more than 2 nodes might result in considerable load on the system.
  3. Asks the user to enter the names of the nodes being created.

The script generates configuration files in ~/color/mainbeta-3/node1, ~/color/mainbeta-3/node2, etc.

  1. At the end the script creates accounts that are necessary for setting up validators and prints their addresses, e.g:

  1. The script saves all output to ./setup-color.log. You may consider keeping it for future reference, as it contains recovery phrases for private keys of the created accounts.

Configure the Software

Allocate beta coins

When you create a validator you will need coins to create the initial delegation.

The Mannet-beta provides a facility called ‘getcoins’ that sends coins for beta network upon request.

  1. Open the link https://getcoins.mainbeta-3.color-platform.org/ in your browser
  2. Paste the account address, created by the script 01-init-nodes.sh at the previous step
  3. Pass the captcha
  4. Press “Send me tokens”. The service will send 1,000,000 Color Coins.

[a][b]

Repeat these steps for all addresses created by the script.

To check that the coins arrived to the account use the following script:

./color/scripts/20-check-accounts.sh

The output should be like this:

Checking accounts

Account:

  Address:       color1u9ml9t043ccec9zdfv74zyflfmuvw8msqep8hw

  Pubkey:

  Coins:         1000000000000uclr

  AccountNumber: 48

  Sequence:      0

Account:

  Address:       color1cyckgusw8eqh2r0370khal02n8ej8vhycdala6

  Pubkey:

  Coins:         1000000000000uclr

  AccountNumber: 49

  Sequence:      0

Please make sure that each account has received 1,000,000,000,000uclr, i.e. 1,000,000 color coins, denominated in uclr, or microcolor.

If you don’t see the coins, please contact me at nikolay@paxdatatech.com or in Telegram @NikolayPakulin.

Open Ports in Firewall

sudo ufw allow 28000:28001/tcp

sudo ufw allow 28000:28009/tcp


Launch the Nodes

To launch the validating node issue the following command:

./color/scripts/30-start-nodes.sh

This command

  1. launches the nodes using configuration files in node1/colord/, node2/colord/, node3/colord/, node4/colord/, node5/colord/ folders,
  2. redirects the logs to node1/node.log, node2/node.log, node3/node.log, node4/node.log, node5/node.log, and
  3. detaches the process from the current shell. It means that after you close the terminal, the processes will keep running in the background.

The node software does not start automatically when the system reboots. Please run this script every time the system reboots.

Windows Subsystem for Linux

If you run the node under Windows, then Windows security subsystem will ask you whether you trust colord application and allow network access.

(sorry for Russian screenshot)

Please tick both choices and click “Allow access” button.

Check that the nodes do run

  1. Make sure that the processes keep running:

./color/scripts/40-list-nodes.sh

This program prints the process identifiers and commands used to launch the nodes:

 2531 ./colord --home node1/colord start

 2532 ./colord --home node2/colord start

(this is the output for the system with 2 nodes)

  1. Have a look at the logs of the nodes:

./color/scripts/41-tail-log.sh

If the nodes connected to the network you see the log like this:

I[2019-12-19|16:01:16.885] Executed block                               module=state height=118111 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:16.898] Committed state                              module=state height=118111 txs=0 appHash=438DB73330B7D2840FD793F812496BD10A95EC6E6097C1F7371A105D8AB6E459

I[2019-12-19|16:01:22.300] Executed block                               module=state height=118112 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:22.314] Committed state                              module=state height=118112 txs=0 appHash=FD3CB709B128FE9709DFC936735BCF4F0CFA2BC05333C2E8C6FF7012A01190A1

I[2019-12-19|16:01:23.218] Executed block                               module=state height=118113 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:23.238] Committed state                              module=state height=118113 txs=0 appHash=8DD8B1DFB1F889E15B576923B421358EFD2172C95F3D081CC67E883AA4B1594E

I[2019-12-19|16:01:28.519] Executed block                               module=state height=118114 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:28.537] Committed state                              module=state height=118114 txs=0 appHash=7C9B10F32C9E0DD35A610A0D956E46E8EA184EF020B5BAABF3CCD9920A834F92

I[2019-12-19|16:01:29.398] Executed block                               module=state height=118115 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:29.413] Committed state                              module=state height=118115 txs=0 appHash=44FDB10CE7E954C36905A08FD4C98C22F6C56115E8303A9EBA81834CE583FFEC

then please proceed to the next step and turn your nodes into validators.

But if you see in the log:

E[2019-12-19|16:02:51.879] Connection failed @ sendRoutine              module=p2p peer=dd03fd3e034f8aa7f585863a2570c8e41faf43ed@58.151.93.108:27400 conn=MConn{58.151.93.108:27400} err="pong timeout"

E[2019-12-19|16:02:51.880] Stopping peer for error                      module=p2p peer="Peer{MConn{58.151.93.108:27400} dd03fd3e034f8aa7f585863a2570c8e41faf43ed out}" err="pong timeout" stack="goroutine 2138 ..."

E[2019-12-19|16:03:21.860] Connection failed @ sendRoutine              module=p2p peer=07fbdc7f145880239f8d46d50d89a24c84172434@58.151.93.108:27104 conn=MConn{58.151.93.108:27104} err="pong timeout"

E[2019-12-19|16:03:21.860] Stopping peer for error                      module=p2p peer="Peer{MConn{58.151.93.108:27104} 07fbdc7f145880239f8d46d50d89a24c84172434 out}" err="pong timeout" stack="goroutine 1998 ..."

Please contact nikolay@paxdatatech.com or in Telegram @NikolayPakulin and describe the issue.


Creating the Validator

By now your node runs in non-validating mode. It will become a validator after processing the transaction “CreateValidator”.

Please note that nodes need to download the whole blockchain beforehand. The new nodes download and process blocks at the speed 5-10 blocks/sec.

When the height of the network is 100,000 blocks or more, this process might take up to 2 days.

Prerequisites

Before invoking the command that turns your nodes into validators please ensure that their state is in line with the chain. Since the nodes need to read all blocks from genesys, it might take some time.

To list the last processed blocks, use the following command:

grep Execute ~/color/mainbeta-3/node1/node.log | tail

The output looks like:

I[2019-12-20|16:42:40.887] Executed block                               module=state height=8720 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:41.643] Executed block                               module=state height=8721 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:42.403] Executed block                               module=state height=8722 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:43.194] Executed block                               module=state height=8723 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:43.923] Executed block                               module=state height=8724 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:44.911] Executed block                               module=state height=8725 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:45.886] Executed block                               module=state height=8726 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:46.621] Executed block                               module=state height=8727 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:47.393] Executed block                               module=state height=8728 validTxs=0 invalidTxs=0

I[2019-12-20|16:42:52.493] Executed block                               module=state height=8729 validTxs=0 invalidTxs=0

Open block explorer in your browser: https://colorscan.mainbeta-3.color-platform.org/ 

ONLY if the current block height of your nodes match the Latest Block Height of the color scan, your nodes are ready to become validators. Otherwise give them some time to catch up.

Create Validators

The following command creates validator based on your nodes.

./color/scripts/50-create-validators.sh <IPADDRESS> <EMAIL>

The argument to this script is the IP address of your nodes. The IP address must be globally routable!

The EMAIL argument will be used to contact the node operator (e.g. you) in case of need, such as node upgrade of network change. This address will be publicly visible. It is recommended not to use private email addresses to avoid spam. Consider creating a special address for this purpose.

The script will ask to enter a description of the node, that will be published in Color Scan bock explorer.

The output of the script should be like this:

Response:

TxHash: F257D0DC7C4D043665EC93C4143E36D065A81EE3F4973DD7E05A4B73D900561B

To check that your node runs as validator, query the validator info. Wait 1-2 minutes before issuing this command:

./color/scripts/43-validator-info.sh

If the output of the command is:

Validator node1

ERROR: No validator found with address colorvaloper130vpvwx3jy9ns20jk5rz22fm6ju6chp2m3jyx5

then something went wrong, and your nodes are not included in the list of validators. Repeat the command in 1-2 minutes, since some time is required to process the transaction.

When the node is a validator, the output looks like this:

Validator node1

Validator

  Operator Address:           colorvaloper130vpvwx3jy9ns20jk5rz22fm6ju6chp2m3jyx5

  Validator Consensus Pubkey: colorsvalconspub1zcjduepqz6s9n7c9mvzq004939wyjkzvfjmkdf6ues93ncljp5vwjmj60ussdf3mpl

  Suspended:                  false

  Status:                     Bonded

  Tokens:                     9950000000

  Delegator Shares:           9950000000.000000000000000000

  Description:                {tokyo-japan@pax   Contact: mailto:beta@paxdatatech.com}

  Unbonding Height:           0

  Unbonding Completion Time:  1970-01-01 00:00:00 +0000 UTC

  Minimum Self Delegation:    1

  Commission:                 rate: 0.050000000000000000, maxRate: 0.200000000000000000, maxChangeRate: 0.010000000000000000, updateTime: 2020-01-15 08:39:02.469443251 +0000 UTC

  League:                     3

  NodeId:                     0

  NodeAddress;             {5d14cd956b49fb0f6b42838ea0ef049d15e2961d 103.125.216.133 %!s(uint16=28000) }

Next, check whether the validators do perform consensus:

./color/scripts/42-validator-state.sh

This command will print the current block height of all nodes.

If the output of the script is

Validator node1: current block height: 0

Validator node2: current block height: 0

it might be due to two reasons: the nodes are not connected to the network, or the nodes are catching up, downloading the blocks.

If the output looks like:

Validator node1: current block height: 12345

Validator node2: current block height: 12345

then the nodes have downloaded the blocks and run as validators.


Unsuspending

If a node is down for more than 100 blocks, it gets suspended. That means, it is excluded from the validation process and receives no awards.

To unsuspend your nodes:

  1. Make sure, your nodes run: the script

./color/scripts/41-tail-log.sh

Should produce log like this:

I[2019-12-19|16:01:16.885] Executed block                               module=state height=118111 validTxs=0 invalidTxs=0

I[2019-12-19|16:01:16.898] Committed state                              module=state height=118111 txs=0 appHash=438DB73330B7D2840FD793F812496BD10A95EC6E6097C1F7371A105D8AB6E459

I[2019-12-19|16:01:22.300] Executed block                               module=state height=118112 validTxs=0 invalidTxs=0

  1. Check that the block height corresponds to the height in the Color Scan

If the height in the log is less, wait for the nodes to catch up.

  1. Unsuspend using the command:

./color/scripts/60-unsuspend.sh

To check the suspension status of your nodes:

./color/scripts/43-validator-info.sh

Check the field “Suspended:”

Restart and Update

Restart nodes

In the case of errors you can restart the nodes.

First, stop  the nodes:

./color/scripts/90-stop-nodes.sh

Color nodes have embedded protection against DDoS attacks. Therefore, in order to prevent reject from other nodes, wait at least 10 seconds before starting the nodes again.

Sleep 10; ./color/scripts/30-start-nodes.sh

Update the software

To update the running software:

  1. Stop the nodes: ./color/scripts/90-stop-nodes.sh 
  2. Update the scripts:

curl https://mainbeta-3.color-platform.org/nodes/color-scripts.tgz\

 -o color-scripts.tgz

tar xf color-scripts.tgz

rm color-scripts.tgz

  1. Then invoke the update script:

./color/scripts/11-update-nodes.sh


[a]um.... the pics still have "testnet faucet"

[b]Yes, this is the point that I left for tommorow