Skip to main content

gRPC API Reference

The Almena daemon exposes a gRPC API defined in the almena.daemon.v1 package. The default endpoint is [::1]:50051 (IPv6 localhost).

Service: DaemonService

Ping

Health check to verify the daemon is running.

rpc Ping(PingRequest) returns (PingResponse);

Request: Empty message.

Response:

FieldTypeDescription
messagestringAlways returns "pong"

GetVersion

Returns the daemon's version string.

rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);

Request: Empty message.

Response:

FieldTypeDescription
versionstringDaemon version (e.g., "2026.1.1-develop")

GetSystemInfo

Returns information about the host operating system.

rpc GetSystemInfo(GetSystemInfoRequest) returns (GetSystemInfoResponse);

Request: Empty message.

Response:

FieldTypeDescription
os_namestringOperating system name (e.g., "macOS")
os_versionstringOS version string (e.g., "15.3.2")

GetGeolocation

Returns geolocation data based on the node's public IP address. Data is fetched from the ipapi.co API.

rpc GetGeolocation(GetGeolocationRequest) returns (GetGeolocationResponse);

Request: Empty message.

Response:

FieldTypeDescription
ipstringPublic IP address
citystringCity name
regionstringRegion or state
country_codestringISO country code (e.g., "US")
country_namestringFull country name
timezonestringTimezone identifier (e.g., "America/New_York")
latitudedoubleGeographic latitude
longitudedoubleGeographic longitude
note

This endpoint requires internet access. It will return a gRPC error if the external API is unavailable.


ListPeers

Returns all discovered P2P peers, including the local node.

rpc ListPeers(ListPeersRequest) returns (ListPeersResponse);

Request: Empty message.

Response:

FieldTypeDescription
peersPeerInfo[]List of discovered peers
local_node_geoGetGeolocationResponseGeolocation of the local node

PeerInfo

FieldTypeDescription
peer_idstringUnique peer identifier (libp2p PeerId)
addressesstring[]Multiaddresses where this peer is reachable
is_internalbooltrue if the peer is on the local network (LAN)
is_connectedbooltrue if currently connected
is_selfbooltrue if this entry represents the local daemon

Proto File

The canonical proto definition is located at:

daemon/proto/almena/daemon/v1/service.proto

Full Definition

syntax = "proto3";

package almena.daemon.v1;

service DaemonService {
rpc Ping(PingRequest) returns (PingResponse);
rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
rpc GetSystemInfo(GetSystemInfoRequest) returns (GetSystemInfoResponse);
rpc GetGeolocation(GetGeolocationRequest) returns (GetGeolocationResponse);
rpc ListPeers(ListPeersRequest) returns (ListPeersResponse);
}

message PingRequest {}
message PingResponse { string message = 1; }

message GetVersionRequest {}
message GetVersionResponse { string version = 1; }

message GetSystemInfoRequest {}
message GetSystemInfoResponse {
string os_name = 1;
string os_version = 2;
}

message GetGeolocationRequest {}
message GetGeolocationResponse {
string ip = 1;
string city = 2;
string region = 3;
string country_code = 4;
string country_name = 5;
string timezone = 6;
double latitude = 7;
double longitude = 8;
}

message ListPeersRequest {}
message ListPeersResponse {
repeated PeerInfo peers = 1;
GetGeolocationResponse local_node_geo = 2;
}

message PeerInfo {
string peer_id = 1;
repeated string addresses = 2;
bool is_internal = 3;
bool is_connected = 4;
bool is_self = 5;
}

Server Reflection

The daemon has gRPC Server Reflection enabled. Compatible tools (Postman, grpcurl, BloomRPC) can discover all available services and methods automatically without needing the proto file.

Connection Examples

grpcurl

# List all services
grpcurl -plaintext '[::1]:50051' list

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

# Get version
grpcurl -plaintext '[::1]:50051' almena.daemon.v1.DaemonService/GetVersion

# List peers
grpcurl -plaintext '[::1]:50051' almena.daemon.v1.DaemonService/ListPeers

Rust (tonic)

use tonic::transport::Channel;

// Generated from proto
pub mod daemon {
tonic::include_proto!("almena.daemon.v1");
}

use daemon::daemon_service_client::DaemonServiceClient;
use daemon::PingRequest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let channel = Channel::from_static("http://[::1]:50051")
.connect()
.await?;

let mut client = DaemonServiceClient::new(channel);
let response = client.ping(PingRequest {}).await?;

println!("Response: {}", response.into_inner().message);
Ok(())
}