Running RSK Node

Angel Java Lopez
4 min readMar 23, 2020

--

Today I want to show how to launch an RSK node, from the command line. The source code of the project is at rskj repository. It is the way I use for my experiments (harnessing, smart contracts deploy and run, etc). The node is a client on the RSK networks, similar to an Ethereum client. The following instructions work for various operating systems. I generally use them in Windows 10. They are more setup instructions and options at RSK Developers Portal (ie you can use a docker image).

I use the fat jar option. First, download the latest release from the releases list In my case, I download the 1.3.0 fat jar. In the developer portal you will find additional information to check the integrity of this download. You can also clone the project source code repository and follow the instructions to compile the project.

You need Java 8 JDK installed. Then, copy the downloaded fat jar to a new folder. And run:

java -cp rskj-core-1.3.0-WASABI-all.jar co.rsk.Start --regtest

The above command launch the node. Nothing appears on screen. It’s simply running. in a local network, called regtest. Alternatively, you can run:

java -cp rskj-core-1.3.0-WASABI-all.jar co.rsk.Start --regtest --reset

with the additional --reset flag to initialize the local database.

If you want to connect to RSK testnet, use:

java -cp rskj-core-1.3.0-WASABI-all.jar co.rsk.Start — testnet

with the --testnet flag. And for mainnet, simply run:

java -cp rskj-core-1.3.0-WASABI-all.jar co.rsk.Start

without specifying the network to use.

Where are the logs?

When running, the node produce some logs that are saved in a local file. Check the logs subfolder of the launching folder, and you will find rsk.log file. A fragment of the log content, extracted from one of my experiments:

2020-03-22-07:32:57.663 INFO [config]  Config ( no ): user properties from -Drsk.conf.file file 'null'2020-03-22-07:32:57.667 INFO [config]  Config ( no ): default properties from installer '/etc/rsk/node.conf'2020-03-22-07:32:58.955 DEBUG [c.r.b.c.Context]  Creating bitcoinj 0.14.4 context.2020-03-22-07:32:59.264 INFO [general]  DB is empty - adding Genesis2020-03-22-07:32:59.265 INFO [general]  Genesis block loaded2020-03-22-07:32:59.314 INFO [general]  New nodeID generated: 796d4c6017ca3424bb4401884c00e2eda1cd48683adeaf3de13d3e1e11ec3b272a4764bb3e65fc7c1eb8caefaed95b8536ee1deaecaf2b9c21ec9bb26c8905712020-03-22-07:32:59.314 INFO [general]  Generated nodeID and its private key stored in C:\Users\Angel\.rsk\regtest\database\nodeId.properties2020-03-22-07:32:59.322 INFO [general]  Public IP wasn't set or resolved, using https://checkip.amazonaws.com to identify it...2020-03-22-07:33:00.977 INFO [general]  Identified public IP: /181.165.60.382020-03-22-07:33:01.195 DEBUG [c.g.j.JsonRpcBasicServer]  created server for interface class co.rsk.rpc.Web3RskImpl with handler class co.rsk.rpc.Web3RskImpl2020-03-22-07:33:01.334 INFO [fullnoderunner]  Starting RSK2020-03-22-07:33:01.334 INFO [fullnoderunner]  Running rsk-dev.json,  core version: 1.3.0-WASABI2020-03-22-07:33:01.334 INFO [fullnoderunner]  git.hash: [36f480d]2020-03-22-07:33:01.334 INFO [fullnoderunner]  build.branch: HEAD2020-03-22-07:33:01.345 INFO [net]  RskJ node started: enode://796d4c6017ca3424bb4401884c00e2eda1cd48683adeaf3de13d3e1e11ec3b272a4764bb3e65fc7c1eb8caefaed95b8536ee1deaecaf2b9c21ec9bb26c890571@181.165.60.38:505012020-03-22-07:33:01.346 INFO [c.r.r.n.Web3HttpServer]  RPC HTTP enabled2020-03-22-07:33:01.361 INFO [net]  Listening for incoming connections, host: /0.0.0.0, port: [50501]

Where is the database?

As other Ethereum or Bitcoin implementations, rskj does not use a relational database. Instead, it uses a local leveldb folders where it saves blocks, transactions receipts, world state and other information. When you run a node in regtest, the folder is:

<userhome>/.rsk/regtest/database

In my Windows 10, it is located at:

C:\users\<user>\.rsk\regtest

Containing subfolter:

C:\users\<user>\.rsk\regtest└───database
├───blocks
├───receipts
├───stateRoots
├───unitrie
└───wallet

How to configure the logs?

Rskj logs system is based on logback. There is a configuration file logback.xml inside the compiled jar. You can copy the file from the repository, and modify it to have more logging options. Then launch the node with additional command line parameter, indicating the path to the new logback file to use:

java -cp rskj-core-1.3.0-WASABI-all.jar -Dlogback.configurationFile=/dev/rskconf/logback.xml co.rsk.Start --regtest

There is a section to enable the console output for the logs:

Enabling console output for the logs

Usually, in my experiments, I turn on some topics:

Set the TRACE level for more logging information

The topics I changed to TRACE level are: execute, blockvalidator, blockexecutor, blockchain, messagehandler, blockchain, blockprocessor.

Many of these topics are defined in the source code, inside classes. For example, if you want to enable TransactionExecutor logging, read the source and discover to logger topic associated:

Logger topic defined inside a class

You can connect to the running node with standard libraries and commands. I prefer to use my own library, described in my post A library and commands to interact with RSK and Ethereum nodes. Also, You have more detailed information at RSK Developer Portal.

Angel “Java” Lopez

--

--