Skip to content

Compile V Systems from source code

B10P0K3 edited this page Oct 10, 2024 · 10 revisions

Operating System

V Systems supports Ubuntu 22.04 LTS aka Jammy Jellyfish. You may be able to get it to work elsewhere, but we support Ubuntu 22.04 LTS. This document assumes that you've provisioned a server somewhere in the cloud, or if using bare metal, have installed the latest Ubuntu 22.04 LTS on your server.

  • Tested latest JDK, Scala, SBT version combinations
    • JDK: 21
    • Scala: 2.12.18
    • SBT: 1.9.9

Compile and install V Systems

Use these commands section by section to compile and install V Systems.

Ubuntu

# GO HOME
cd ~/

# UPDATE PACKAGE SOURCES
sudo apt update

# INSTALL DEPENDANCIES
apt install -yqq curl sudo openjdk-21-jdk git apt-transport-https gnupg vim

# INSTALL SBT AND JAVA
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
apt update &&
        apt install -y sbt

# GET SOURCE CODE
git clone https://github.com/virtualeconomy/v-systems

# BUILD
cd v-systems
sbt packageAll

# INSTALL
cd target
sudo dpkg -i vsys_0.4.2_all.deb

NixOS

Nix Develop

# GET SOURCE CODE
git clone https://github.com/virtualeconomy/v-systems
cd v-systems

git checkout nixos

# Start SBT environment
nix develop

# Build V Systems
sbt packageAll

Nix Build

# GET SOURCE CODE
git clone https://github.com/virtualeconomy/v-systems
cd v-systems

git checkout nixos

# Build
nix build --extra-experimental-features nix-command --extra-experimental-features flakes

note: If you're building testnet and want appropriate .deb files, you should replace sbt packageALL with sbt -Dnetwork=testnet packageAll. The JAR file works for both testnet and mainnet if properly configured.

Configuration

Now it's time to check your vsys config! It's embedded into the deb package and unpacked to /usr/share/vsys/conf/vsys.conf and symlinked to /etc/vsys/vsys.conf. Please read V Systems Mainnet Node Configuration File and edit your vsys config with caution.

The default vsys directory (for wallet, blockchain and other node files) is /var/lib/vsys/.vsys/. If you want to change vsys directory, you should change directory in /etc/vsys/vsys.conf

sudo vi /etc/vsys/vsys.conf
vsys {
  directory = <set to your path>
  logging-level = DEBUG
  ...

Start the node!

Systemd users can start the node with

sudo systemctl start vsys 

and enable autoload on start with

sudo systemctl enable vsys

You can find vsys app logs in journald:

journalctl -u vsys.service -f

Or run the node with JAR file

mkdir -p /opt/vsys
cp ./vsys-mainnet.conf ./target/vsys-all-0.4.2.jar /opt/vsys/
cd /opt/vsys
java -jar vsys-all-0.4.2.jar vsys-mainnet.conf

Running Tests

Execute

sbt test

Note

If you prefer to work with SBT in the interactive mode, open it with settings:

SBT_OPTS="${SBT_OPTS} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled" sbt

to solve the Metaspace error problem.