Skip to content

Allow hostname-based RPC communication (remove SocketAddr restriction) #66

@moisesPompilio

Description

@moisesPompilio

Problem

Currently, LDK Server expects the Bitcoin RPC address to be passed as a host:port string, which it then tries to parse using Rust’s SocketAddr. However, SocketAddr only supports IP addresses (IPv4/IPv6) — hostnames are not allowed.

This is a problem in containerized environments (like Docker), where inter-service communication is usually done via hostnames (e.g., bitcoind:18443). Since SocketAddr rejects hostnames, users are forced to use hardcoded IPs, which can change if a container restarts, making the setup fragile.

LDK Server also extracts the IP and port from SocketAddr to pass them separately into set_chain_source_bitcoind_rpc, so even if we could parse the string ourselves, this separation would still be necessary.

Example use case

Running ldk-server and bitcoind in separate containers on the same Docker network. Ideally, I want to set:

rpc_address = "bitcoind:18443"

But this fails because "bitcoind" is not a valid IP address.

Proposed solution

A clean solution — already used in other projects like Eclair and LND — is to split the configuration into two fields:

rpc_host = "bitcoind"
rpc_port = 18443

This avoids the limitations of SocketAddr entirely and fits better with containerized setups.

Considerations

This would require changing how validation is performed, since the current implementation relies on SocketAddr parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions