How To: Build R5 From Source
Difficulty Level: Professional
Clone The Source
Clone the source code from the canonical repository using the following command:
After cloning, navigate to the source code folder using:
Pre-Requisites
You will need to have Python 3
, Golang 1.19
, and a C
compiler (such as gcc
, for example) to build the core binary, and additional Python dependencies when building the full set of protocol tools.
The install.py
script installs all required dependencies automatically, but if you are running Windows, you might need to install a C compiler separately, even after running the install script.
You can run:
Or, if on Windows:
!! IMPORTANT !!
If your system restricts system-wide package installing - eg. Ubuntu Desktop 24.04 - you may have to take some extra steps to install all dependencies before building the package.
The build.py
script will automatically detect most of such limitations and do all the work for you, however, if after installing all dependencies you face issues with building the code from source, please follow the steps below.
First, make sure you have golang-1.19/stable
installed. If you're using Ubuntu, you can install it via snap
with the following command:
To install the python
dependencies, you will need to create a virtual environment to separate the program packages from your system packages. First, install v-env
with the following command:
Then, create the virtual environment (named r5-venv
in this example):
Enter the virtual environment you have just created with:
Now you can install the python dependencies with:
And follow the instructions below to build the binaries. Please be aware that you still need to have your virtual environment active to be able to build the SDK tools, otherwise, you will only be able to build the main node binary using the build.py
script with the --coreonly
flag.
Building R5
You can build the binaries by running the build.py
script. To compile only the core node binary, run the script with the --coreonly
flag. If no flag is provided, the script will build the full R5 Protocol with all its tools.
Run on Linux/macOS:
Or on Windows:
Full Protocol Build
This build compiles all the tools included with the R5 Protocol, giving you a fully functioning node in your /build
folder. The main r5
binary is the custom node relayer, and inside the /build/bin
folder you will find:
cliwallet
A CLI wallet module that can generate wallet addresses, send transactions, and perform other wallet functions.
node
The core binary of the R5 node. It can be executed separately and accepts flags, though we recommend starting the node via the provided relayer.
proxy
A native SSL proxy for RPC operators. It accepts the --gencert flag to generate self-signed certificates and can serve requests via the SSL port.
console
R5's custom CLI console module, offering a user-friendly interface even for beginners.
scdev
SCdev is a powerful smart contract interface that allows you to compile, deploy, and interact with smart contracts, as well as manage accounts.
Folder Structure
The /build
folder should contain the following subdirectories:
/bin
Contains the main binaries and their dependencies, including configuration files and tools.
/config
Contains configuration files for R5 networks.
/genesis
Contains genesis files for testnet, devnet, and local networks.
Additional directories, such as the main data storage folder, will be created when the node starts.
Core Binary Build
If you prefer to build only the core protocol binary, run:
After building, the binary will be located in the /build folder. Note that this build does not utilise the r5 node relayer and will require the standard Geth flag structure. It does not offer ready-support for running testnet or devnet nodes, so we do not recommend this method unless you are very familiar with Geth.
Running Your Node
After building, start your node using the r5 Relayer with the desired configuration. For example, to start a mainnet RPC archive node with mining enabled, run:
You may also configure initialisation parameters using the node.ini file for a more streamlined deployment.
Last updated