Gradle building
Setup instructions for gradle build in docker container​
This is a deterministic build process used to build Rootstock node JAR file. It provides a way to be reasonably sure that the JAR is built from the GitHub RSKj repository. It also makes sure that the same tested dependencies are used and statically built into the executable.
It's highly recommended to follow the steps by yourself to avoid contamination of the process.
Starting with v6.4.0, the minimum supported Java LTS version is Java 17. Previous Java versions will no longer be supported. The following example for Linux OS is showing instructions for v6.3.1, and thus uses jdk 8, this must be replaced by jdk 17 for v6.4.0 and up.
Install Docker​
Depending on your OS, you can install Docker following the official Docker guide:
See how to Setup and Run RSKj using Java.
Build Container​
Create a Dockerfile
to setup the build environment.
- Linux
- Mac OSX
// FROM ubuntu:16.04
apt-get update -y && \
apt-get install -y git curl gnupg-curl openjdk-8-jdk && \
rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean
gpg --keyserver https://secchannel.rsk.co/release.asc --recv-keys 1A92D8942171AFA951A857365DECF4415E3B8FA4
gpg --finger 1A92D8942171AFA951A857365DECF4415E3B8FA4
git clone --single-branch --depth 1 --branch ARROWHEAD-6.5.0 https://github.com/rsksmart/rskj.git /code/rskj
git clone https://github.com/rsksmart/reproducible-builds
CP /Users/{$USER}/reproducible-builds/rskj/6.5.0-arrowhead/Dockerfile /Users/{$USER}/code/rskj
WORKDIR /code/rskj
gpg --verify SHA256SUMS.asc
sha256sum --check SHA256SUMS.asc
./configure.sh
./gradlew clean build -x test
brew update && \
brew install git gnupg openjdk@8 && \
rm -rf /var/lib/apt/lists/* && \
brew autoremove && \
brew cleanup
gpg --keyserver https://secchannel.rsk.co/release.asc --recv-keys 1A92D8942171AFA951A857365DECF4415E3B8FA4
gpg --finger 1A92D8942171AFA951A857365DECF4415E3B8FA4
git clone --single-branch --depth 1 --branch ARROWHEAD-6.5.0 https://github.com/rsksmart/rskj.git ./code/rskj
git clone https://github.com/rsksmart/reproducible-builds
CP /Users/{$USER}/reproducible-builds/rskj/6.5.0-arrowhead/Dockerfile /Users/{$USER}/code/rskj
cd ./code/rskj
gpg --verify SHA256SUMS.asc
sha256sum --check SHA256SUMS.asc
./configure.sh
./gradlew clean build -x test
Response:
You should get the following as the final response, after running the above steps:
BUILD SUCCESSFUL in 55s
14 actionable tasks: 13 executed, 1 up-to-date
If you get the error: zsh: command not found: sha256sum
Run the command brew install coreutils
If you are not familiar with Docker or the Dockerfile
format: what this does is use the Ubuntu 16.04 base image and install git
, curl
, gnupg-curl
and openjdk-8-jdk
, required for building the Rootstock node.
Run build​
To create a reproducible build, run the command below in the same directory:
docker build -t rskj/6.5.0-arrowhead .
if you run into any problems, ensure you're running the commands on the right folder and also ensure docker daemon is running is updated to the recent version. See how to Setup node on Docker
This may take several minutes to complete. What is done is:
- Place in the RSKj repository root because we need Gradle and the project.
- Runs the secure chain verification process.
- Compile a reproducible RSKj node.
./gradlew clean build -x test
builds without running tests.
Verify Build​
The last step of the build prints the sha256sum
of the files, to obtain SHA-256
checksums, run the following command in the same directory as shown above:
docker run --rm rskj/6.5.0-arrowhead sh -c 'sha256sum * | grep -v javadoc.jar'
Check Results​
After running the build process, a JAR file will be created in /rskj/rskj-core/build/libs/
, into the docker container.
You can check the SHA256 sum of the result file and compare it to the one published by Rootstock for that version.
294f99ec76befa7d9ef18eca28d0c884ceb463ce855ef23ddb7a476e551ba191 rskj-core-6.5.0-ARROWHEAD-all.jar
ec4ea3143fb95fbf878b24c8d00ebe5994c4586ecf92930743b26dc77395c17a rskj-core-6.5.0-ARROWHEAD-sources.jar
7721f59632d9ff825b0bb23cf52fa3eff347852068a03d792ce18d0deae547ae rskj-core-6.5.0-ARROWHEAD.jar
16283f4aebbf5b5b35c63f098d81fb0d2aeb5e9fc3be51128ab300333127077f rskj-core-6.5.0-ARROWHEAD.module
ee4f7e684044302e3819f8c50d9b85af5b3391d14e6ed6110b98e8387a1b2837 rskj-core-6.5.0-ARROWHEAD.pom
For SHA256 sum of older versions check the releases page.
If you check inside the JAR file, you will find that the dates of the files are the same as the version commit you are using.
More Resources
- Install Rootstock Node
- See Reproducible builds
- Check out the latest rskj releases