Begineer

 

How to install RNode / Node on RChain Network.

 

Installing RNode

There are two possibilities to setup a rnode instance and connect to a network for deployment of your smart-contracts:

  • Install a non-Docker instance on your computer or

  • Install a Docker instance locally

 

If you are new and want to start your local rnode instance on your pc with only a few clicks then go with the docker setup.
(recommended way for beginners): Follow this tutorial.

Running RNode (non-Docker)

Rnode is the instance, where the smart-contracts are executed. This chapter describes, how to install and setup the rnode instance on your pc and connect to an existing network.

Install RNode

We deliver RNode software in a variety of installation packages. Installation packages are available at both RChain and Github. We recommend using the latest release.

 

In the command examples below, you must update based on the version number of RNode you want by replacing “x” with the numbers in your installation version.

Should there be errors, when you install RNode for the first time, please make shure that you have the newest Java version installed.

Linux

This part describes, how to setup a rnode instance on linux

Install JDK (Java)

The rnode instance for linux needs the Java JDK preinstalled. Many distribution have this included into their os.

 

1sudo apt-get update

2sudo apt-get install -y software-properties-common

3sudo add-apt-repository -y ppa:openjdk-r/ppa

4sudo apt-get update

5sudo apt-get install -y openjdk-11-jdk

 

 
 

Platform

Package type

Installation information

  Debian 9 Stretch

  Ubuntu 16.04 LTS

  Ubuntu 18.04.3 LTS

   Debian Package (.deb)

   First time installation:
sudo apt install ./rnode_x.x.x_all.deb

   Re-installation:
systemctl stop rnode
sudo apt remove rnode
rm -rf /var/lib/rnode/rspace
sudo apt install ./rnode_x.x.x_all.deb

  Fedora 27

  Fedora 28

  Fedora 29

  Fedora 30

   RPM Package (.rpm)

   First time installation:
sudo dnf install ./rnode-x.x.x-1.noarch.rpm
   Re-installation:
sudo systemctl stop rnode && dnf remove rnode && rm -rf /var/lib/rnode/rspace && sudo dnf install ./rnode-x.x.x-1.noarch.rpm

  Other Linux distributions

  Tarball (.tgz)

   Prerequisites
Java – We recommend Open JDK 11,
Libsodium – installed in a standard prefix (/user or /user/local)

   First time installation:
tar -xvf rnode-x.x.x.tgz

 

#Mac

 

Platform

Package type

Installation information

Mac

Tarball (.tgz)

Prerequisites
Java – We recommend Open JDK 11,
Libsodium – installed in a standard prefix (/user or /user/local)

First time installation:
tar -xvf rnode-x.x.x.tgz
cd rnode-0.x.x
./macos_install.sh

Note:
The macos_install.sh script installs the Homebrew package manager on your machine and then installs libsodium.
If you already have Homebrew installed on your machine, you can refer to the script for how to install libsodium directly.

 

ARM

You can run RNode on Raspberry pi. An example of this, including installation and deployment instructions, is available at .

To connect to an existing network

 

Please fill in the <bootstrap ID>. The current network ID is posted on RChain public testnet information.

rnode run --network-id <arg> --shard-id <arg> --bootstrap <arg> --finalization-rate <arg> --fault-tolerance-threshold <arg> --synchrony-constraint-threshold <arg> --fork-choice-stale-threshold <arg> --fork-choice-check-if-stale-interval <arg> --drop-peer-after-retries <arg> --give-up-after-skipped <arg>
--network-id <arg> The network to run on (testnet , mainnet).

--shard-id <arg> The network is splitted into shards for scaling.

--bootstrap <arg> The bootstrap server for initial connection to the network.

--finalization-rate <arg> Block finalization is triggered after adding every 'n' blocks. Use this option to configure this.

--fault-tolerance-threshold <arg> Float value representing that the node tolerates up to fault-tolerance-threshold fraction of the total weight to equivocate.

--synchrony-constraint-threshold <arg>Float value representing that the node waits until at least synchrony-constraint-threshold fraction of the validators (by stake weight) proposed at least one block since is node's last proposal.

--fork-choice-stale-threshold <arg> Node will request for fork choice tips if the latest FCT is more then ForkChoiceStaleThreshold old.

--fork-choice-check-if-stale-interval <arg> Interval for check if fork choice tip is stale.

--drop-peer-after-retries <arg> Fair round robin dispatcher drop inactive peer after round robin rounds. After giving up several times the peer gets dropped from the queue.

--give-up-after-skipped <arg> Fair round robin dispatcher give up and try next peer after skipped packets. Skipped packets are buffered in other peers packet queues.

Examples:

run rnode


./rnode run --network-id mainnet --shard-id root --bootstrap "rnode://487e2c0c519b450b61253dea0a23b4d184a50089@node0.root-shard.mainnet.rchain.coop?protocol=40400&discovery=40404" --finalization-rate 1 --fault-tolerance-threshold -1 --synchrony-constraint-threshold 0 --fork-choice-stale-threshold 30minutes --fork-choice-check-if-stale-interval 30minutes --drop-peer-after-retries 0 --give-up-after-skipped 0
help documentation


./rnode --help

f the message: - Waiting for first connection is there for more than 1 minute, please check your ports and ip: Network Configuration

Running RNode (Docker)

This chapter helps you to start a rnode instance. With this you are connecting to existing validator on mainnet, testnet. Additionally you can creating a local network on your computer, where you can deploy your smart-contracts to.

Docker Setup (Beginners)

If you are new and want to start your local rnode (docker) instance on your pc with only a few clicks: Then follow this tutorial.

Docker Setup (Experts)

 

Please fill in the <bootstrap ID>. The current network ID is posted on RChain public testnet information.

docker run -it --rm --name rnode -v /data/rhoc-daemon-01:/var/lib/rnode rchain/rnode:latest run --network <args> --shard-id <args> --bootstrap <args> -finalization-rate <args> --fault-tolerance-threshold <args> --synchrony-constraint-threshold <args> --fork-choice-stale-threshold <args> --fork-choice-check-if-stale-interval <args> --drop-peer-after-retries <args> --give-up-after-skipped <args>
--network-id <arg> The network to run on (testnet , mainnet).

--shard-id <arg> The network is splitted into shards for scaling.

--bootstrap <arg> The bootstrap server for initial connection to the network.

--finalization-rate <arg> Block finalization is triggered after adding every 'n' blocks. Use this option to configure this.

--fault-tolerance-threshold <arg> Float value representing that the node tolerates up to fault-tolerance-threshold fraction of the total weight to equivocate.

--synchrony-constraint-threshold <arg>Float value representing that the node waits until at least synchrony-constraint-threshold fraction of the validators (by stake weight) proposed at least one block since is node's last proposal.

--fork-choice-stale-threshold <arg> Node will request for fork choice tips if the latest FCT is more then ForkChoiceStaleThreshold old.

--fork-choice-check-if-stale-interval <arg> Interval for check if fork choice tip is stale.

--drop-peer-after-retries <arg> Fair round robin dispatcher drop inactive peer after round robin rounds. After giving up several times the peer gets dropped from the queue.

--give-up-after-skipped <arg> Fair round robin dispatcher give up and try next peer after skipped packets. Skipped packets are buffered in other peers packet queues

Examples:

  • run rnode

docker run --rm -d -v C:\Users\Nakamoto\Desktop\Rnode:/var/lib/rnode --network host --name rchain-mainet-peer rchain/rnode:latest run \
--bootstrap "rnode://487e2c0c519b450b61253dea0a23b4d184a50089@node0.root-shard.mainnet.rchain.coop?protocol=40400&discovery=40404" \
--finalization-rate 1 --fault-tolerance-threshold -1 --network-id mainnet --shard-name root --max-number-of-parents 1

please fill in you own userpath -v C:\Users\<your-user-name>\Desktop\Rnode. Also copy conf files into Rnode folder: link

  • help documentation

docker run rchain/rnode:latest --help

Docker for Mac

 

Docker for Mac will only work with static NAT and port forwarding. network=host does not work on Mac. See RNode supported network configuration for more information on static NAT and port forwarding.

  • Bootstrap address – Enter the address of the bootstrap node you want to connect with. See RNode bootstrap addresses for bootstrap nodes supported by the RChain core development team.

  • Validator private key – Insert the key if you are a validator of test net, or if you are creating a private network and have a bonds file included in your genesis block.

  • Network configuration – If you want to specify your ports, include –p in the run command. If you want to specify your host, include –host in the run command.

Tips for working with RNode in Docker

Naming Containers

Once the network is created, the server container will be put into the network, and then referenced by the client. It’s easier if you give your server container a name. This is an example of of naming a server ‘rnode-server-local’.

 

1docker run --name rnode-server-local rchain/rnode:latest

Using the –host flag

If you want to create a local docker network which consists of some nodes and a bootstrap node, you will have to specify the nodes’ addresses with the –host flag. Make sure to not use the nodes’ IP addresses for the –host flag. Instead use the hostnames. If the network is called ‘rnode-net’ and you named a docker container ‘rnode-server-local’, the hostname of that docker container is ‘rnode-server-local.rnode-net’.

Sharing directories with containers

To share a directory with a container use the volume command. You will need to create a directory on your local system that will store all of the RNode related files. Once the directory is created, you can share this directory with the Docker container by using the volume command. Below is an example of how the volume parameter can be specified as part of a run command.

RNode requires the path /var/lib/rnode exist on startup. Each instance of RNode requires its own separate /var/lib/rnode directory.

docker run -v "path to local directory":/var

With this, you complete this workshop successfully!!