Setup node on Java

Make sure your system meets the minimum requirements before installing RSK nodes on it.

You also need to install Java 8 JDK.

Install the node using a JAR file

The Fat JAR or Uber JAR can be downloaded or compiled (in a reproducible way or not).

To run the node:

$ java -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start

Replace <PATH-TO-THE-RSKJ-JAR> with your path to the JAR file. As an example: C:/RskjCode/rskj-core-2.0.1-PAPYRUS-all.jar

Using import sync

Note: This feature is optional.

Note: This feature, first released as part of RSKj v2.0.1, is currently experimental.

If you don’t want to synchronize your node in the default way, you can use the import sync feature. This method imports a synchronized database from a trusted origin in a fraction of the time currently required.

Use this command to run the node:

$ java -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start --import

If your hardware meets the minimum hardware requirements, but you get a memory error during the process, please consider adding the following flag to the command to change the memory allocated to the process:

$ java -Xmx4G -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start --import

Replace <PATH-TO-THE-RSKJ-JAR> with your path to the JAR file. As an example: C:/RskjCode/rskj-core-2.0.1-PAPYRUS-all.jar

For further reference, check out the database.import configuration setting.

Check the RPC

If you see no output, it means that the node is running. To check, you can open a new console tab (it is important you do not close this one or interrupt the process) and issue a request to the node’s RPC HTTP server. This is an example using cURL:

$ curl localhost:4444/1.1.0/ -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

The response should look similar to {"jsonrpc":"2.0","id":1,"result":"0xfc0"}, where the result property is the number of the latest block that has been synced (in hexadecimal).

Switching networks

If you want to change the network use these commands:

  • Mainnet: java -cp <PATH-TO-THE-RSKJ-FATJAR> co.rsk.Start
  • Testnet: java -cp <PATH-TO-THE-RSKJ-FATJAR> co.rsk.Start --testnet
  • Regtest: java -cp <PATH-TO-THE-RSKJ-FATJAR> co.rsk.Start --regtest

Replace <PATH-TO-THE-RSKJ-FATJAR> with your path to the jar file. As an example: C:/RskjCode/rskj-core-2.0.1-PAPYRUS-all.jar

Video