wallet: app-owned child lifecycle + user-chosen ChainSource #73

Merged
sirius merged 2 commits from wt/t_69ce8e46 into feat/wallet-create-import 2026-09-15 00:24:32 +00:00
Owner

This card builds on PR #66 (feat/wallet-create-import, open, not yet merged). The app now owns monero-wallet-rpc -- and monerod when the chain source is local -- instead of requiring the user to start them and export ONIONWIRE_WALLET_RPC.

What changed

  • ChainSource enum (src/wallet.rs): None / Local(monerod_bin, datadir) / Remote(host, port). No default remote node; Remote is constructed only from explicit user input. A .onion Remote is refused without a SOCKS proxy (separate card).
  • WalletChild (src/wallet_child.rs, new): spawns monero-wallet-rpc with --rpc-bind-ip 127.0.0.1, a random free loopback port, generated --rpc-login, and --wallet-dir $ONIONWIRE_HOME/wallet; spawns monerod too for a local source. --trusted-daemon is never passed.
  • Generated RPC creds are sealed in the encrypted SQLCipher store (wallet_child table, AEAD on top of whole-db encryption) -- never a plaintext file. The Wallet client is built from the generated loopback URL, not from_env.
  • Readiness: chain_ready() requires synchronized==true, height>0, height>=target_height. can_spend() and can_verify_receipts() gate on it. Unsynced means receipts stay verified=0 and spend is refused with a clear message.
  • Timeouts are backend-aware: local management calls keep 5s; chain-dependent calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT) because a first sync or a remote daemon outlasts 5s and a 5s cap there is what left receipts permanently unverified.
  • node.rs ingest_receipt gates on can_verify_receipts() instead of configured() alone.
  • docs/WALLET.md rewritten for the child lifecycle + chain source.

Verification

  • cargo check --locked --target x86_64-unknown-linux-gnu: clean.
  • cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets -- -D warnings: clean.
  • cargo test --locked --target x86_64-unknown-linux-gnu: green (31/31 wallet tests pass, including 11 new wallet_child unit tests that assert the spawned argv, the None-source spawns nothing, the onion remote is refused without SOCKS, creds come from the encrypted store and not from_env, the readiness predicate, and the longer chain budget; plus the at-rest store test that proves wallet_child creds are sealed and never plaintext on disk).
  • No default remote node: proven by none_source_is_disabled_and_starts_nothing + onion_remote_daemon_is_refused_without_a_socks_proxy.

Scope (per card): allowed src/wallet.rs, src/wallet_child.rs (new), src/node.rs, src/lib.rs, tests/wallet.rs, tests/node*.rs, docs/WALLET.md. Did not touch src/pay.rs, src/tui.rs, src/store.rs schema beyond the wallet_child table + sealed load/save, android/, crates/onionwire-sdk/, .forgejo/, scripts/, docs/PROTOCOL.md.

Base: feat/wallet-create-import (PR #66). Do not rebase onto main.

This card builds on PR #66 (feat/wallet-create-import, open, not yet merged). The app now owns monero-wallet-rpc -- and monerod when the chain source is local -- instead of requiring the user to start them and export ONIONWIRE_WALLET_RPC. What changed - ChainSource enum (src/wallet.rs): None / Local(monerod_bin, datadir) / Remote(host, port). No default remote node; Remote is constructed only from explicit user input. A .onion Remote is refused without a SOCKS proxy (separate card). - WalletChild (src/wallet_child.rs, new): spawns monero-wallet-rpc with --rpc-bind-ip 127.0.0.1, a random free loopback port, generated --rpc-login, and --wallet-dir $ONIONWIRE_HOME/wallet; spawns monerod too for a local source. --trusted-daemon is never passed. - Generated RPC creds are sealed in the encrypted SQLCipher store (wallet_child table, AEAD on top of whole-db encryption) -- never a plaintext file. The Wallet client is built from the generated loopback URL, not from_env. - Readiness: chain_ready() requires synchronized==true, height>0, height>=target_height. can_spend() and can_verify_receipts() gate on it. Unsynced means receipts stay verified=0 and spend is refused with a clear message. - Timeouts are backend-aware: local management calls keep 5s; chain-dependent calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT) because a first sync or a remote daemon outlasts 5s and a 5s cap there is what left receipts permanently unverified. - node.rs ingest_receipt gates on can_verify_receipts() instead of configured() alone. - docs/WALLET.md rewritten for the child lifecycle + chain source. Verification - cargo check --locked --target x86_64-unknown-linux-gnu: clean. - cargo clippy --locked --target x86_64-unknown-linux-gnu --all-targets -- -D warnings: clean. - cargo test --locked --target x86_64-unknown-linux-gnu: green (31/31 wallet tests pass, including 11 new wallet_child unit tests that assert the spawned argv, the None-source spawns nothing, the onion remote is refused without SOCKS, creds come from the encrypted store and not from_env, the readiness predicate, and the longer chain budget; plus the at-rest store test that proves wallet_child creds are sealed and never plaintext on disk). - No default remote node: proven by none_source_is_disabled_and_starts_nothing + onion_remote_daemon_is_refused_without_a_socks_proxy. Scope (per card): allowed src/wallet.rs, src/wallet_child.rs (new), src/node.rs, src/lib.rs, tests/wallet.rs, tests/node*.rs, docs/WALLET.md. Did not touch src/pay.rs, src/tui.rs, src/store.rs schema beyond the wallet_child table + sealed load/save, android/, crates/onionwire-sdk/, .forgejo/, scripts/, docs/PROTOCOL.md. Base: feat/wallet-create-import (PR #66). Do not rebase onto main.
wallet: app-owned child lifecycle + user-chosen ChainSource
All checks were successful
ci / test (pull_request) Successful in 4m23s
ci / sdk (pull_request) Successful in 1m16s
b45dbf95be
The app now owns monero-wallet-rpc (and monerod when the chain source is
local) instead of requiring the user to start them and export
ONIONWIRE_WALLET_RPC.

- ChainSource enum: None / Local { monerod_bin, datadir } / Remote { host,
  port }. No default remote node; Remote is only constructed from explicit
  user input. A .onion Remote is refused without a SOCKS proxy (separate
  card).
- WalletChild in src/wallet_child.rs spawns monero-wallet-rpc with
  --rpc-bind-ip 127.0.0.1, a random free loopback port, generated
  --rpc-login, and --wallet-dir /wallet; monerod too for a
  local source. --trusted-daemon is never passed.
- Generated RPC creds are sealed in the encrypted SQLCipher store
  (wallet_child table, AEAD on top of whole-db encryption), never a
  plaintext file. The Wallet client is built from the generated loopback
  URL, not from_env.
- Readiness predicate: chain_ready() requires synchronized==true, height>0,
  height>=target_height; can_spend() and can_verify_receipts() gate on it.
  Unsynced -> receipts stay verified=0, spend refused with a clear message.
- Backend-aware timeouts: local management calls keep 5s; chain-dependent
  calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT),
  because a first sync or a remote daemon outlasts 5s and a 5s cap there
  is what left receipts permanently unverified.
- node.rs ingest_receipt gates on can_verify_receipts() instead of
  configured() alone.
- docs/WALLET.md rewritten for the child lifecycle + chain source.

Base: feat/wallet-create-import (PR #66). Do not rebase onto main.

Co-Authored-By: Hermes Agent <agent@local>
sirius force-pushed wt/t_69ce8e46 from b45dbf95be
All checks were successful
ci / test (pull_request) Successful in 4m23s
ci / sdk (pull_request) Successful in 1m16s
to 8331a2dde6
All checks were successful
ci / test (pull_request) Successful in 4m1s
ci / sdk (pull_request) Successful in 1m2s
2026-09-14 23:55:36 +00:00
Compare
Merge branch 'feat/wallet-create-import' into wt/t_69ce8e46
All checks were successful
ci / test (pull_request) Successful in 3m56s
ci / sdk (pull_request) Successful in 57s
3f62734efd
sirius merged commit 7cd316b65f into feat/wallet-create-import 2026-09-15 00:24:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!73
No description provided.