Here you have the steps to compile and run a RSK node on Linux.

This explanation uses Bodhi Linux, on Ubuntu Linux with a Moksha desktop (it's pretty lightweight).

This page is organized in this way:

Pre-requisites

First of all, you will need to install:

Dependency Details
Git for Linux Download this Git command line tool
Java 8 JDK Follow the steps to install Java. To check if installation went correctly, check the version with command: java-version. Then, as admin, modify /etc/enviroment adding JAVA_HOME="/usr/lib/jvm/java-8-oracle"
SDKMAN To install, run: curl -s "https://get.sdkman.io" \| bash and source "$HOME/.sdkman/bin/sdkman-init.sh". Of course, you need curl package to do this. Then, to check if installation went correctly, check version with command: sdk version
GRADLE Run command sdk install gradle 4.1
IntelliJ IDEA Community Install this Java IDE

Get the source code

Using the installed command-line tool Git, you need to retrieve (or clone) the RskJ Github source code from here.

Run this command on Git command line:

git clone --recursive https://github.com/rsksmart/rskj.git

Note: it is better to download the code into a short path.

Ensure the security chain

Ensure the security chain of the downloaded source code as explained here.

Get external dependencies

Before you can launch IntelliJ IDEA, there is an important step. Browse in your RskJ cloned directory and then launch configure.sh with the following terminal command: ./configure.sh. This will download and set important components (e.g. Gradle Wrapper).

Compiling and running the node

Now, you can launch IntelliJ IDEA: in a terminal, and from the folder you extracted the tar.gz, go into idea/bin/. Then, type the following command to load the script:

./idea/sh

When IntelliJ IDEA is launched you should have a window with different choices. - Choose Import project. - Browse in the RskJ downloaded code the file rskj\build.gradle and select it. Click NEXT. - Within the dialog select Use default gradle wrapper and then click Finish. Keep IntelliJ IDEA opened.

img

IDEA Build/Run configuration

We need to create a new configuration profile to run the node from IDEA. Part of the configuration information that needs to be provided is related to the node itself, you can find a sample configuration file on: rskj/rskj-core/src/main/resources/config/rsk-sample.conf. Some settings need to be initialized and you can learn to do that here.

Next step is to create a new configuration profile on IDEA, that can be done by clicking on Run -> Edit Configurations or as shown in the following picture:

img

Then set the options as shown below:

img

  • Main Class: co.rsk.Start
  • VM Options: -Drsk.conf.file=/path-to-rsk-conf/rsk-sample.conf
  • Working directory: /path-to-code/rskJ
  • Use classpath of module: rskj-core_main
  • JRE need to be set as: Default (1.8 - SDK of 'rsk-core_main' module)

Running the node

We are ready to run the node using IDEA, just press the Start (green arrow) button at the right of the configuration we've just created.

img

If everything is OK you should see the debug information like that:

img

And yes! Congratulations! Now you're running a local RSK node :)