Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New RPC: z_getnewaccount #5178

Closed
str4d opened this issue May 24, 2021 · 3 comments
Closed

New RPC: z_getnewaccount #5178

str4d opened this issue May 24, 2021 · 3 comments
Assignees
Labels
A-rpc-interface Area: RPC interface A-wallet Area: Wallet

Comments

@str4d
Copy link
Contributor

str4d commented May 24, 2021

  • Selects the next available sequential account number under the UA-compatible HD seed phrase and persists account metadata to the wallet.
    • This enables rescanning to find all accounts.
  • Generates the corresponding spend authorities for the best and second-best shielded pools, and the transparent pool.
  • Returns JSON dict with e.g. the account number (u31) and the default / first UA (containing the default addresses for each pool).
  • Does not return account 231 - 1 (see ZIP 316: Document standard key structure for Unified Addresses zips#511).
@str4d str4d added A-wallet Area: Wallet A-rpc-interface Area: RPC interface labels May 24, 2021
@str4d str4d added this to the Core Sprint 2021-44 milestone Nov 22, 2021
@str4d str4d added the S-committed Status: Planned work in a sprint label Nov 22, 2021
@r3ld3v r3ld3v added S-committed Status: Planned work in a sprint and removed S-committed Status: Planned work in a sprint labels Dec 7, 2021
@r3ld3v r3ld3v added S-committed Status: Planned work in a sprint and removed S-committed Status: Planned work in a sprint labels Dec 20, 2021
@r3ld3v r3ld3v modified the milestones: Core Sprint 2021-50, 2021-52 Jan 3, 2022
@nuttycom
Copy link
Contributor

nuttycom commented Jan 13, 2022

Notes from a discussion in Slack:

I think that this RPC method should not return the default address. There are a few reasons for this:

First, we would like to encourage our users to avoid reuse of unified addresses that contain transparent components. Ideally, we'd like our users to migrate their workflows to be account-centric rather than address-centric, and separating address generation from account generation helps with this.

Secondly, accounts are not associated with a specific set of receivers; instead, selection of receiver types is performed only at address generation, and inside of zcashd the internal USK and UFVK for every account support all implemented receiver types. This is important for forward compatibility: we only want the UFVK to be cached in memory; we don't want it to persist with a subset of the possible item types. The same is true of the USK; we want to regenerate it from the mnemonic seed for the account as needed. That way, when we add future protocols there's essentially nothing that needs to be updated in the wallet's data store, because we don't store anything that needs to be updated!

When you look up the UFVKId for a given receiver, you get enough information to reproduce the address you generated from which that receiver was extracted, as it was at the time it was generated. The UFVKId will change when we add a new pool, and newly created addresses will map their receivers to the new UFVKId. Importantly, multiple UFVKIds can map to the same logical UFVK, so the metadata of newly generated addresses will refer to the "updated" UFVKId.

@str4d
Copy link
Contributor Author

str4d commented Jan 13, 2022

I'm not sure I agree with all of the above. However, it's easy to add new fields to this RPC later, so I'm okay with requiring users to make a second RPC call for now, and then if it becomes a clear UX misstep then we can add the output again.

str4d added a commit to str4d/zcash that referenced this issue Jan 13, 2022
@str4d
Copy link
Contributor Author

str4d commented Jan 19, 2022

Closed by #5475, merged into #5419.

@str4d str4d closed this as completed Jan 19, 2022
@nuttycom nuttycom removed the S-committed Status: Planned work in a sprint label Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc-interface Area: RPC interface A-wallet Area: Wallet
Projects
None yet
Development

No branches or pull requests

4 participants