Add Iroh P2P transport for private remote connectivity - #1311
Open
rueckwaerts wants to merge 13 commits into
Open
Add Iroh P2P transport for private remote connectivity#1311rueckwaerts wants to merge 13 commits into
rueckwaerts wants to merge 13 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional Iroh QUIC P2P transport to electrs, allowing wallet software to connect directly to a home node from anywhere in the world — without TCP port forwarding, Tor, or VPN.
The user only needs to know the server's Iroh Node ID (a 64-char hex string). NAT traversal is handled automatically.
Motivation
Users running electrs at home (Start9, Umbrel, RaspiBlitz, bare metal) currently have no good option for remote access:
This is a real barrier for anyone who wants to use their own node from outside their home network.
Iroh solves this cleanly: the relay is only used for the initial handshake (NAT traversal). Once connected, traffic flows peer-to-peer, end-to-end encrypted via QUIC/TLS. The relay never sees payload content.
Notably, Fedimint — a well-known Bitcoin privacy project — uses Iroh for exactly this reason: P2P connectivity between guardians without infrastructure overhead. This validates Iroh as a production-ready choice for Bitcoin-related software.
Changes
src/iroh_listener.rs— new Iroh listener (accepts incoming QUIC connections, pipes to existingrecv_loop)src/server.rs—pub fn recv_loop(no logic change, visibility only)src/lib.rs—iroh_listenermodule included behindirohfeature flagCargo.toml— optionalirohfeature:cargo build --release --features irohConfiguration
Secret key path defaults to
~/.electrs/iroh_secret_key.bin, configurable via:The Node ID is printed to logs on startup — no file write required.
ALPN
Testing
Tested end-to-end from outside home network, against electrs on Start9:
Client-side bridge: https://github.com/rueckwaerts/iroh-electrum-bridge
Sparrow integration PR: sparrowwallet/sparrow#2021
Electrum integration PR: spesmilo/electrum#10695
Feature Flag
Iroh support is fully opt-in and does not affect existing builds: