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: listaddresses #5328

Closed
nuttycom opened this issue Sep 28, 2021 · 8 comments · Fixed by #5343
Closed

New RPC: listaddresses #5328

nuttycom opened this issue Sep 28, 2021 · 8 comments · Fixed by #5343
Labels
A-rpc-interface Area: RPC interface A-wallet Area: Wallet

Comments

@nuttycom
Copy link
Contributor

Returns a list of all addresses tracked by the wallet. This should return a heterogenous list containing

  • Legacy transparent addresses, as objects of the form {"transparent": { "address": "<taddr>", "watchonly": <true/false>}}
  • Sprout addresses, as objects of the form {"sprout": { "address": "<zaddr>"}}
  • Legacy Sapling addresses, as objects of the form {"sapling": { "address": "<zaddr>"}}
  • Unified addresses, as objects of the form {"unified": {"address": "<ua>", "receiver_types": ["transparent", "sapling", ...]}}
@daira
Copy link
Contributor

daira commented Sep 29, 2021

Do we also need listviewingkeys?

@str4d
Copy link
Contributor

str4d commented Oct 4, 2021

Let's keep this issue focused on address visibility (not viewing keys). I'd like to iterate on the design for this quickly, because users are currently having trouble accessing t-addrs (#5338), so if we can get a coherent design, we can deploy the minimal parts of it quickly and then expand later.

@nuttycom
Copy link
Contributor Author

nuttycom commented Oct 6, 2021

@adityapk00 does this API, as implemented in #5343, support your needs?

Edit: After discussing the API with @str4d, we're going to expand this to include a bit more information, expect updates.

@adityapk00
Copy link
Contributor

Yes, #5343 works for Zecwallet.

@nuttycom
Copy link
Contributor Author

nuttycom commented Oct 6, 2021

@adityapk00 Here's an iteration on the structure that we're contemplating returning from this method:

[
  {
    "source": "imported|imported_watchonly|legacy_random|legacy_hdseed|mnemonic_hdseed",
    "transparent": { 
      "addresses": ["t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1", ...],
      "change_addresses": ["t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1", ...]
    },
    "sprout": {
      "addresses": ["ztbx5DLDxa5ZLFTchHhoPNkKs57QzSyib6UqXpEdy76T1aUdFxJt1w9318Z8DJ73XzbnWHKEZP9Yjg712N5kMmP4QzS9iC9", ...]
    },
    "sapling": [
      {
        "zip32_account_id": 0, -- optional field, not present for imported_watchonly source
        "addresses": [
          { "address": "ztbx5DLDxa5ZLFTchHhoPNkKs57QzSyib6UqXpEdy76T1aUdFxJt1w9318Z8DJ73XzbnWHKEZP9Yjg712N5kMmP4QzS9iC9", "diversifier_index": 0 },
          ...
      },
      ...
    ]
  }, 
  ...
]

Unified address support will then be added under a new "unified" key in the coming weeks.

@str4d
Copy link
Contributor

str4d commented Oct 6, 2021

  • I'd argue that ['sapling']['addresses'] should be a list of strings for now, with more details left to other APIs (or a future verbosity option).
  • (If we do include this detail) diversifier_index should just be a JSON number (unlike diversifier which is an opaque byte array).

@nuttycom
Copy link
Contributor Author

nuttycom commented Oct 6, 2021

@str4d Update to replace "keypool" with "legacy_random" since Sprout keys are randomly generated and are not pooled; the transparent keypool behavior is really an implementation detail over random key generation used to work around wallet locking behavior.

@nuttycom
Copy link
Contributor Author

nuttycom commented Oct 8, 2021

@adityapk00 Here's the final structure:

[
  {
    "source": "imported|imported_watchonly|keypool|legacy_seed|mnemonic_seed"
    "transparent": {
      "addresses": ["t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1", ...],
      "changeAddresses": ["t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1", ...]
    },
    "sprout": {
      "addresses": ["ztbx5DLDxa5ZLFTchHhoPNkKs57QzSyib6UqXpEdy76T1aUdFxJt1w9318Z8DJ73XzbnWHKEZP9Yjg712N5kMmP4QzS9iC9", ...]
    },
    "sapling": [ -- each element in this list represents a set of diversified addresses derived from a single IVK. 
      {
        "zip32AccountId": 0, -- optional field, not present for imported/watchonly sources,
        "addresses": [
          "ztbx5DLDxa5ZLFTchHhoPNkKs57QzSyib6UqXpEdy76T1aUdFxJt1w9318Z8DJ73XzbnWHKEZP9Yjg712N5kMmP4QzS9iC9",
          ...
        ]
      },
      ...
    ]
  },
  ...
]

We're getting ready for the hotfix release and just wanted to confirm that this will work for your needs.

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

Successfully merging a pull request may close this issue.

5 participants