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.

  1. Download and install Visual Studio Code.
  2. Open VSCode and navigate to the Extensions view by clicking the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X.
  3. 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.

  1. Open a terminal or command prompt.
  2. Run the following command to clone the Haveno repository:
git clone https://git.haveno.com/haveno.git
  1. 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:

  1. Install Java Development Kit (JDK) 21:
sudo apt install openjdk-21-jdk

or for macOS:

brew install openjdk@21
  1. Verify the installation:
java -version

Ensure it returns Java 21.

For Windows:

  1. Download and install OpenJDK 21.
  2. Add the JAVA_HOME environment variable to point to the JDK installation folder.
  3. 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:

  1. Build the Haveno daemon:
./gradlew :daemon:shadowJar

Building the Flutter App

Once the daemon is built, proceed to building the Flutter frontend:

  1. Ensure you are in the project root directory.
  2. 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:

  1. Ensure you have an Apple Developer account.
  2. 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:

  1. 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:

  1. Linux/macOS/Windows: Navigate to the build folder and run the executable for your platform.
  2. 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.