Skip to main content

Daemon Setup

The Almena daemon (almenad) is the background service that powers the P2P network and exposes the gRPC API. This guide covers how to install and run it.

Prerequisites

  • Rust toolchain (2021 edition, install via rustup)
  • Protocol Buffers compiler (protoc)
    • macOS: brew install protobuf
    • Linux: apt install protobuf-compiler
    • Windows: choco install protoc
  • Task runner (taskfile.dev)

Installation from Source

git clone git@github.com:almena-network/daemon.git
cd daemon
task install
task build

The release binary is located at target/release/almenad.

Running the Daemon

Development Mode

task dev

This starts the daemon with:

  • Debug logging enabled
  • Data stored in ./workspace/ directory
  • Hot reload via cargo watch
  • gRPC server on [::1]:50051 (IPv6 localhost)

Production Mode

./almenad

Or with custom settings:

./almenad --grpc-addr "[::1]:50051"

CLI Options

FlagDefaultDescription
--grpc-addr[::1]:50051gRPC listen address
--devfalseEnable debug logging and use dev workspace
--versionPrint version and exit

Environment Variables

VariableDescription
RUST_LOGLog level override (trace, debug, info, warn, error)
GRPC_ADDRAlternative to --grpc-addr flag
ALMENAD_DATA_DIRCustom data directory (dev mode only)

Data Directories

The daemon stores its data in platform-specific locations:

PlatformPath
macOS~/Library/Application Support/network.almena.daemon
Linux~/.local/share/network.almena.daemon
Windows%APPDATA%\network.almena.daemon

In development mode (--dev), all data is stored in the local ./workspace/ directory.

Platform Installers

Pre-built installers are available for each platform:

PlatformFormatBuild Command
macOS.pkg (signed and notarized)task package:darwin
Linux.debtask package:linux
Windows.msitask package:windows

The macOS installer registers the daemon as a LaunchAgent (starts automatically on login). On Linux, a systemd user service is created. On Windows, it runs as a Windows Service.

Verifying the Installation

Once the daemon is running, verify connectivity with any gRPC client:

# Using grpcurl
grpcurl -plaintext '[::1]:50051' almena.daemon.v1.DaemonService/Ping

Expected response:

{
"message": "pong"
}

The daemon also supports gRPC Server Reflection, so tools like Postman and grpcurl can discover all available methods automatically.

P2P Networking

The daemon automatically discovers other Almena nodes on your local network using mDNS (multicast DNS). Discovered peers appear in the ListPeers response.

Current P2P capabilities:

  • Transport: TCP
  • Encryption: Noise protocol
  • Multiplexing: Yamux
  • Discovery: mDNS (LAN only)
  • Idle timeout: 60 seconds
Coming Soon

Internet peer discovery (beyond LAN) and relay-based connectivity are planned for future releases.