# Set explicit default UFW rulessudoufwdefaultdenyincomingsudoufwdefaultallowoutgoing
Allow SSH
sudoufwallow22/tcp
Allow remote RPC connections with Rootstock node
sudoufwallow4444sudoufwallow4445
Allow P2P Connections
sudoufwallow30303/tcpsudoufwallow30303/udp
Enable Firewall
sudoufwenable
To check status of UFW and see the current rules
sudoufwstatusverbose
Building a Node on Rootstock
Dependencies
Rootstock uses Java 8
Install Java
# If you have a previous version of Java - remove it.sudoaptpurgeopenjdk-*# Remove unused packagessudoaptautoremove# Install Java 8sudoaptinstallopenjdk-8-jdk# Verify Installationjava-version
Create Directories for Rootstock
# Create directory for Rootstockmkdir/root/rootstock# Create a folder for configurationmkdir/root/rootstock/config
Ctrl + X and Y to exit and confirm saving changes to a file.
Create Data Directory to store chain data for Rootstock blockchain.
mkdir/root/rootstock/database/mainnet/
Download Rootstock
# Download Rootstock within your "rootstock" directory.cd./root/rootstock/gitclone--recursivehttps://github.com/rsksmart/rskj.gitcdrskjgitcheckouttags/ARROWHEAD-6.3.1-bARROWHEAD-6.3.1
# From within the root of your "rskj" directory, run the following../configure.sh# This will download and set important components (ex. Gradle Wrapper)
Compile the node
# From within the root of your "rskj" directory, run the following../gradlewbuild-xtest
Create systemd service for Rootstock node
# Copy and paste the code below and run it within your terminal.sudoecho"[Unit]Description=Rootstock NodeAfter=network.targetStartLimitIntervalSec=200StartLimitBurst=5[Service]Type=simpleRestart=on-failureRestartSec=5TimeoutSec=900User=rootNice=0LimitNOFILE=200000WorkingDirectory=/root/rootstock/rskj/rskj-core/build/libs/ExecStart=/usr/bin/java -Drsk.conf.file=/root/rootstock/config/node.conf -jar /root/rootstock/rskj/rskj-core/build/libs/rskj-core-6.3.1-ARROWHEAD-all.jar co.rsk.StartKillSignal=SIGTERM[Install]WantedBy=multi-user.target">/etc/systemd/system/rootstock.service
Start Rootstock Node
sudosystemctldaemon-reload# refresh for systemd configuration changessudosystemctlenablerootstock.service# enable rootstock.service at start upsudosystemctlstartrootstock.service# start rootstock.service
View Logs for Debugging
This method of installing does not allow you to view sync progress.
journalctl-furootstock.service
Query Rootstock Node
curl-H"Content-Type: application/json"-XPOST--data'{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'http://localhost:4444# The response should resemble the follow{"jsonrpc":"2.0","id":1,"result":"0xcab5ab"}