rpc: Implement z_importviewingkey for Sapling#431
Open
mnm458 wants to merge 1 commit into
Open
Conversation
Add support for importing Sapling extended full viewing keys via the z_importviewingkey JSON-RPC method. The wallet will track incoming and outgoing transactions for addresses derived from imported keys but will not have spending authority. Supports the "whenkeyisnew", "yes", and "no" rescan options with a configurable start height, matching zcashd's interface. Closes zcash#80
0cd39a8 to
dca4cbe
Compare
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
Implements
z_importviewingkeyRPC method for Sapling extended full viewing keys (issue #80).Imports a Sapling extfvk (
zxviews/zxviewtestsapling) so the wallet can track transactions without holding spending authority. Accounts are stored withAccountPurpose::ViewOnly.fetch_account_birthdaytojson_rpc::utilsas a shared helper (also needed by Implementz_importkeyandz_exportkeyfor Sapling #400 — whichever merges first provides it).Why implement this despite zero usage in the survey? Watch-only wallets are a fundamental capability for exchanges, auditors, and operators who need to monitor balances without holding spending keys. As zcashd is deprecated, this becomes the only path for users to import existing viewing keys into the new stack. It also supports the separation-of-concerns model where spending keys stay on cold storage while
a hot node tracks balances.
Test plan
cargo build— cleancargo test -p zallet import_viewing_key— 13/13 passingzcashdand Zallet output #16)Close rpc: Implement
z_importviewingkey#80