Skip to content

node: Tor control ADD_ONION and Electrum hidden service - #646

Open
rearden-grok[bot] wants to merge 8 commits into
net/onion-addrmanfrom
net/tor-control-hs
Open

rearden-grok[bot] wants to merge 8 commits into
net/onion-addrmanfrom
net/tor-control-hs

Conversation

@rearden-grok

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

Copy link
Copy Markdown
Contributor

Plan docs/personal-node-plans/03-tor-control-hs.md: system tor control AUTH + persistent Electrum ADD_ONION. Fake control port only — no live Tor.

Stacked on #645 (net/onion-addrman). NixOS After/Wants tor.service when control is set; labeled nixos-module-runtime.

Summary

  • Control AUTH with cookie hex or quoted password, then GETINFO version. Wrong cookie is 515 / start Init error. Unset --tor-control does not connect.
  • --tor-control [HOST:PORT] (omit ADDR → 127.0.0.1:9051), --tor-control-cookie, --tor-control-password.
  • ADD_ONION NEW:ED25519-V3 persists {datadir}/onion/electrum.priv (0600). Reuse sends the stored blob and keeps the same ServiceID.
  • --tor-control + --electrum-listen maps virtual port to 127.0.0.1:<bound> and logs ….onion:port. RPC stays off the onion.
  • server.features.hosts is { "<id>.onion": { "tcp_port": N } } with no ssl_port.
  • NixOS tor.control / tor.controlCookie / electrum.hiddenService. Eval pins --tor-control. Runtime test uses a dummy tor.service (not live tor).

Test plan

  • cargo test -p rbitcoin-node --lib tor_control_
  • cargo test -p rbitcoin-node --lib tor_add_onion_
  • cargo test -p rbitcoin-node --lib electrum_hidden_service_add_onion_when_listening
  • cargo test -p rbitcoin-electrum --lib features_hosts_onion_tcp
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo deny check / ./scripts/ast-grep.sh / cargo fmt --all -- --check
  • nix build .#checks.x86_64-linux.nixos-module-eval --no-link
  • required GitHub checks green
  • nixos-module-runtime (labeled)

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
rearden-grok Bot force-pushed the net/tor-control-hs branch 3 times, most recently from 0f707c9 to 40f1a56 Compare September 20, 2026 14:17
rearden-grok Bot and others added 8 commits September 20, 2026 07:40
Cookie hex and quoted password AUTHENTICATE, then GETINFO version.
Wrong cookie is a 515 error, not a panic. Fake control only — no live Tor.

Co-authored-by: Cursor <cursoragent@cursor.com>
NEW writes PrivateKey to the path (0600 on Unix). A second call sends
the stored blob and must get the same ServiceID from the fake control.

Co-authored-by: Cursor <cursoragent@cursor.com>
Omitted ADDR is 127.0.0.1:9051. Cookie or password; failed AUTH is Init.
Unset --tor-control does not open a control connection.

Co-authored-by: Cursor <cursoragent@cursor.com>
Virtual port and target are the bound Electrum port on 127.0.0.1.
Key lives at {datadir}/onion/electrum.priv. Log the .onion:port.

Co-authored-by: Cursor <cursoragent@cursor.com>
OnceLock so ADD_ONION can fill the hostname after the TCP bind.
No ssl_port. Empty hosts object when no onion is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
First-class tor.control / controlCookie and electrum.hiddenService.
When set, systemd After/Wants tor.service. Eval pins --tor-control argv.
RPC stays off the onion.

Co-authored-by: Cursor <cursoragent@cursor.com>
dispatch_pinned cognitive complexity and start_electrum argument
count exceeded the workspace -D warnings bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
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