Skip to content

net: P2P --listen-onion inbound hidden service - #651

Open
rearden-grok[bot] wants to merge 5 commits into
net/ephemeral-torfrom
net/listen-onion
Open

rearden-grok[bot] wants to merge 5 commits into
net/ephemeral-torfrom
net/listen-onion

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Plan 07 (docs/personal-node-plans/07-p2p-onion-inbound.md). Stacked on #649 (net/ephemeral-tor).

  • --listen-onion with --no-listen binds 127.0.0.1:0 (no 0.0.0.0). --max-inbound 0 or missing --tor-control is a Config error. --i2p-accept-incoming may use that loopback.
  • After control AUTH, ADD_ONION maps the network default P2P port to the loopback bind and persists {datadir}/onion/p2p.priv (0600). Fake control SID is stored as a hostname string (checksum is not a valid v3).
  • addrv2 self-announce sends AddrV2::TorV3 when listen-onion is on. --no-discover still gossips the onion and lists it in getnetworkinfo.localaddresses; it does not gossip --external-ip unless discover and a clearnet listen are on.
  • NixOS p2p.listenOnion (default false); After/Wants tor.service via existing control. Runtime argv greps --listen-onion.

No live Tor. No Arti.

Test plan

  • cargo test -p rbitcoin-net --lib listen_onion_
  • cargo test -p rbitcoin-net --lib self_announce_onion
  • cargo test -p rbitcoin-node --lib listen_onion_
  • cargo test -p rbitcoin-node --lib p2p_add_onion
  • cargo test -p rbitcoin-rpc --lib getnetworkinfo_includes_p2p_onion
  • nix build .#checks.x86_64-linux.nixos-module-eval --no-link
  • required CI + nixos-module-runtime

Do not merge unless asked.

Made with Cursor

@rearden-grok rearden-grok Bot added the nixos-module-runtime Run NixOS module VM test (nixos-module-runtime), not just eval label Sep 19, 2026
rearden-grok Bot and others added 5 commits September 19, 2026 19:00
Even with --no-listen, start_p2p_bind uses 127.0.0.1:0 so Tor can
forward. --max-inbound 0 and missing --tor-control are Config errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
Persist {datadir}/onion/p2p.priv. Virtual port is the network default
P2P port; target is the actual loopback listen.

Co-authored-by: Cursor <cursoragent@cursor.com>
PeerHub stores the HS hostname (fake control SIDs are not valid v3).
--no-discover still announces onion; clearnet listen off suppresses
--external-ip. getnetworkinfo lists the onion.

Co-authored-by: Cursor <cursoragent@cursor.com>
First-class NixOS option; After=tor.service already implied by control.
Runtime argv greps --listen-onion.

Co-authored-by: Cursor <cursoragent@cursor.com>
Dropping the client transport at handshake return raced the accept
loop off the snapshot. Hold the session and wait longer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nixos-module-runtime Run NixOS module VM test (nixos-module-runtime), not just eval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants