Skip to content

Build from Source

This guide covers building Fukuii from source for development or custom builds.

Prerequisites

Required Software

Software Version Purpose
JDK 21 Runtime and build
sbt 1.10.7+ Scala build tool
Git Any Version control

Install JDK 21

sudo apt-get update
sudo apt-get install openjdk-21-jdk
brew install openjdk@21

Download from Adoptium and install.

Verify installation:

java -version
# Should show: openjdk version "21.x.x"

Install sbt

echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt
brew install sbt

Download the MSI installer from scala-sbt.org

Clone the Repository

git clone https://github.com/chippr-robotics/fukuii.git
cd fukuii

Initialize Submodules

Fukuii uses git submodules for some dependencies:

git submodule update --init --recursive

Build Commands

Compile

# Compile all modules
sbt compile-all

# Or compile individual modules
sbt bytes/compile
sbt crypto/compile
sbt rlp/compile
sbt compile  # Main module

Build Distribution

# Create distribution ZIP
sbt dist

The distribution is created at: target/universal/fukuii-<version>.zip

Build Assembly JAR

# Create fat JAR with all dependencies
sbt assembly

The JAR is created at: target/scala-3.3.4/fukuii-assembly-<version>.jar

Run from Source

Using sbt

# Run ETC mainnet node
sbt "run etc"

# Run Mordor testnet node
sbt "run mordor"

Using Distribution

# Extract distribution
cd target/universal
unzip fukuii-*.zip
cd fukuii-*/

# Make launcher executable
chmod +x bin/fukuii

# Run
./bin/fukuii etc

Development Commands

Code Quality

# Format all code
sbt formatAll

# Check formatting (what CI runs)
sbt formatCheck

# Run static analysis
sbt runScapegoat

Testing

# Run all tests
sbt testAll

# Run with coverage
sbt testCoverage

# Run specific module tests
sbt bytes/test
sbt crypto/test
sbt rlp/test

# Run integration tests
sbt "IntegrationTest / test"

Prepare for PR

# Format, lint, and test
sbt pp

Configuration

JVM Options

Create or edit .jvmopts in the project root:

-Xms1g
-Xmx4g
-XX:+UseG1GC

Build Settings

The main build configuration is in build.sbt. Module dependencies are in project/Dependencies.scala.

Troubleshooting

Out of Memory

Increase heap size in .jvmopts:

-Xmx8g

Compilation Errors

Ensure you're using JDK 21:

java -version

Submodule Issues

Re-initialize submodules:

git submodule deinit -f .
git submodule update --init --recursive

sbt Resolution Errors

Clear caches:

rm -rf ~/.ivy2/cache
rm -rf ~/.sbt/1.0/plugins/target
sbt clean compile

Next Steps