Building Haveno from Source
This guide will walk you through setting up your development environment, cloning the Haveno repository, and building the project from source. The steps will vary slightly depending on your operating system (Windows, macOS, or Linux).
Prerequisites
1. Install Visual Studio Code (VSCode)
VSCode is the recommended IDE for working with Haveno.
- Download and install Visual Studio Code.
- Open VSCode and navigate to the Extensions view by clicking the Extensions icon in the Activity Bar or pressing
Ctrl+Shift+X
. - Search for Flutter in the Extensions Marketplace and install the Flutter extension.
2. Install Flutter
Ensure Flutter is installed on your machine by following the official Flutter installation guide for your operating system:
After installing Flutter, run the following command to verify the installation:
flutter doctor
Ensure that all required components are installed (including Dart, VSCode, and platform-specific dependencies).
Cloning the Repository
Before you can start working on Haveno, you'll need to clone the repository. Make sure git
is installed on your system.
- Open a terminal or command prompt.
- Run the following command to clone the Haveno repository:
git clone https://git.haveno.com/haveno.git
- Navigate into the cloned repository:
cd haveno
Setting Up the Java SDK (Daemon-Side)
Haveno requires a specific version of the Java SDK for building the backend daemon. Make sure you have the correct version of Java installed:
For macOS and Linux:
- Install Java Development Kit (JDK) 21:
sudo apt install openjdk-21-jdk
or for macOS:
brew install openjdk@21
- Verify the installation:
java -version
Ensure it returns Java 21.
For Windows:
- Download and install OpenJDK 21.
- Add the
JAVA_HOME
environment variable to point to the JDK installation folder. - Verify the installation by running the command in the terminal:
java -version
You may need to reboot your computer if the above command doesn't work
Building the Haveno Daemon
Once the environment is set up, follow these steps to build the daemon:
- Build the Haveno daemon:
./gradlew :daemon:shadowJar
Building the Flutter App
Once the daemon is built, proceed to building the Flutter frontend:
- Ensure you are in the project root directory.
- Run the following command to build the Flutter app:
flutter build <platform>
For example:
- Windows:
flutter build windows
- Linux:
flutter build linux
- macOS:
flutter build macos
For Android or iOS, make sure you have the necessary emulators or physical devices set up.
Signing the Flutter Binaries
Depending on your platform, you may need to sign the binaries before distribution.
For macOS:
- Ensure you have an Apple Developer account.
- Use the following command to sign the binary:
codesign --deep --force --verbose --sign "Developer ID Application: Your Name (Team ID)" path/to/flutter/binary
For Windows:
- Use signtool to sign the binary:
signtool sign /a /tr http://timestamp.digicert.com /td sha256 /fd sha256 /v <path-to-your-exe>
For Linux:
Signing isn't as common on Linux, but you can use GPG for package signing if needed:
gpg --armor --output haveno.asc --detach-sig haveno.AppImage
Running Haveno
To run Haveno after the build:
- Linux/macOS/Windows: Navigate to the build folder and run the executable for your platform.
- Android/iOS: Install the APK/IPA on your device or run it directly via
flutter run
.
Additional Notes
- Ensure you keep all your dependencies up to date by running:
flutter pub get
- For troubleshooting, use
flutter doctor
to diagnose common issues.