Setup node using Java
To setup a Rootstock node using Java, you need to:
- Ensure your system meets the minimum requirements for installing the Rootstock node.
- Install Java 17 JDK.
Starting with v6.4.0, the minimum supported Java LTS version is Java 17. Previous Java versions will no longer be supported.
- Ensure you have
Rosettainstalled. This is typically pre-installed on recent macOS versions. - Download an x86 JDK build, such as Azul Zulu 17 (x86), to ensure compatibility with x86 based software.
Video walkthrough
Install the node using a JAR file
Download and Setup
-
Download the JAR: Download the Fat JAR or Uber JAR from RSKj releases, or compile it reproducibly.
-
Create Directory: Create a directory for the node.
mkdir rskj-node-jar
cd ~/rskj-node-jar
- Move the JAR: Move or copy the just downloaded jar file to your directory.
mv ~/Downloads/rskj-core-7.0.0-LOVELL-all.jar SHA256SUMS.asc /Users/{user}/rskj-node-jar/
Run the Node
- Linux, Mac OSX
- Windows
java -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start
java -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start
Replace <PATH-TO-THE-RSKJ-JAR> with the actual path to your JAR file. For example, C:/RskjCode/rskj-core-7.0.0-LOVELL-all.jar.
Using Import Sync
Instead of syncing the whole chain from peers, a new node can be bootstrapped from published bootstrap data — a pre-synchronized database, signed by its publishers. RSKj downloads and verifies it for you; there is no file to fetch yourself and no path to pass to the flag.
Every time a node starts with import enabled, it deletes its database directory and downloads the bootstrap data again — even if the node was fully synced a minute earlier. Run it as a one-off from the command line, and never leave database.import.enabled = true in a configuration file.
In short:
- Check that you are on Java 17 and RSKj
VETIVER-9.0.4or later — earlier versions cannot read the bootstrap data published today. - Make sure you have room for a full node's database, per the minimum requirements, plus about three times the size of the bootstrap archive in temporary space.
- Run the node once with
--import. RSKj downloads the published bootstrap data, checks that enough trusted signers agree on it, and loads it into a fresh database. - Stop the node and start it again without
--import. It continues syncing from the imported height. - Remove the leftover archive and extracted file from the temporary directory.
- Linux, Mac OSX
- Windows
java -Xmx4G -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start --import
C:\> java -Xmx4G -cp <PATH-TO-THE-RSKJ-JAR> co.rsk.Start --import
Set -Xmx4G on this command. Left out, the JVM sizes the heap from the machine's physical RAM instead, so what the import gets depends on the host rather than on what the import needs — and it runs out only after the download has already finished. If the import still fails with OutOfMemoryError, raise it further.
Replace <PATH-TO-THE-RSKJ-JAR> with your JAR file path. For configuration details, see database.import setting.
For the full procedure — checking which height the import will land you on before committing to the download, confirming it worked, cleaning up, and what each failure message means — see Bootstrap a node using Import Sync.
Check the RPC
After starting the node, if there's no output, this means it's running correctly.
- To confirm, open a new console tab (it is important you do not close this tab or interrupt the process) and test the node's RPC server. A sample cURL request:
- Linux, Mac OSX
- Windows
curl http://localhost:4444 -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
curl http://localhost:4444 -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
Output:
{"jsonrpc":"2.0","id":67,"result":"RSKj/6.6.0/Mac OS X/Java17/SNAPSHOT-95a8f1ab84"}
- To check the block number:
- Linux, Mac OSX
- Windows
curl -X POST http://localhost:4444/ -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_blockNumber","params":[],"id":1}'
curl -X POST http://localhost:4444/ -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_blockNumber","params":[],"id":1}'
Output:
{"jsonrpc":"2.0","id":1,"result":"0x3710"}
Now, you have successfully setup a Rootstock node using the jar file.
The result property represents the latest synced block in hexadecimal.
Switching networks
To change networks on the RSKj node, use the following 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 the actual path to your jar file. For example: C:/RskjCode/rskj-core-7.0.0-LOVELL-all.jar.