feat: Add watch-only addresses (#55) - #56
Conversation
701127e to
0df02fb
Compare
5b0e70c to
17d0a83
Compare
|
I think this is a great and welcome feature that opens up many new use cases for the wallet app: checking a cold wallet balance safely, transparently monitoring donation/charity funds, just to name a few. Very inspired by where the wallet app is heading :) A few considerations, mainly from the UX side:
Beyond these points, looks good to me! I assume watch support for generation addresses is coming too (great!) |
Register an external viewing address, scoped to an account, to monitor its incoming UTXOs without any ability to spend. Supports ViewingAddress today (EC hybrid is scoped but gated on a serializable viewing-key form in neptune-wallet). A single watch-only concept with an optional capability: - Viewing key only: shows the total amount received (incoming UTXOs are confirmed against the block via the public receiver digest). - Viewing key + receiver preimage (imported as a hex Digest, validated by preimage.hash() == receiver_digest): also detects spends and shows a real, timelock-aware balance (available vs locked, with the next unlock date). Both announced UTXOs and guesser (mining) rewards are detected; guesser rewards are picked up from the block structure whenever a watched address is the block's guesser, mirroring par_scan_for_incoming_utxo. Watch-only UTXOs live in their own per-account tables, so they never enter the account balance nor become spendable inputs, and they roll back with reorgs. Backend: new wallet/watch_only.rs (parse/validate, scan, spend detection, balance breakdown), watch_only_addresses/watch_only_utxos tables + migrations, a scan hook in update_new_tip and rollback in roll_back, and three Tauri commands. Frontend: a new account-scoped /watch-only page with an import form and a per-address amount/balance table. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump neptune-wallet dependency to 0.14.2 which adds support for the bech32 encoding of EC hybrid viewing keys. And add support for adding EC hybrid viewing keys as watch-only addresses. refactor: Drop unused leveldb-sys dependency & crate Was only needed to shadow an unused/untouched dependency of leveldb-sys imported transitively from the former dependency neptune-core. After the upstream crate separation (in v0.14.2) of neptune-archival-mutator-set, neptune-wallet and neptune-consensus no longer depend on neptune-database. So this whole unused module that was never executed can now be deleted. Fewer lines \o/
- total received - balance, only available if receiver preimage was impoprted Also auto-update balance when a new block is received.
Allows the detection of UTXOs in the genesis block for watch-only addresses. Only generation addresses received UTXOs in the genesis block and generation addresses don't yet have a viewing key struct so this is future-proofing for the watch-only capabilities only. Cf. Neptune-Crypto/neptune-core#952
Users are more likely to remember and identify the address, not the viewing key they used to start monitoring that address.
Mirror the check used for regular addresses: Do not record UTXOs if they carry an unknown type script since we cannot know if we (or the owner of the address) can satisfy this type script.
…s known Only changes to frontend: Even when the receiver preimage is not known, we cna still show the value of all timelocked UTXOs, as they cannot have been spent yet if they are timelocked.
Can be used to measure *how long* a timelock is applied for.
66206e6 to
49025b2
Compare
|
Agreed on point 3 and 4: Change "label" to "name", and make name required. About the scope: Global or account-tied watch-only addresses? Also: A follow-up feature plays well together with associating the watch-only addresses with accounts: |
73ca7c4 to
db135d1
Compare
|
3 and 4 have been implemented: Rename "label" to "name" and make this value required. |
Register an external viewing address, scoped to an account, to monitor its incoming UTXOs without any ability to spend. Supports ViewingAddress today (EC hybrid is scoped but gated on a serializable viewing-key form in neptune-wallet).
A single watch-only concept with an optional capability:
Both announced UTXOs and guesser (mining) rewards are detected; guesser rewards are picked up from the block structure whenever a watched address is the block's guesser, mirroring par_scan_for_incoming_utxo.
Watch-only UTXOs live in their own per-account tables, so they never enter the account balance nor become spendable inputs, and they roll back with reorgs.
Backend: new wallet/watch_only.rs (parse/validate, scan, spend detection, balance breakdown), watch_only_addresses/watch_only_utxos tables + migrations, a scan hook in update_new_tip and rollback in roll_back, and three Tauri commands. Frontend: a new account-scoped /watch-only page with an import form and a per-address amount/balance table.