joinmarket-webui / jam

Your sats. Your privacy. Your profit.
https://jamapp.org
MIT License
255 stars 53 forks source link

Show xpubs for accounts #620

Open proofofjogi opened 1 year ago

proofofjogi commented 1 year ago

Is your feature request related to a problem? Please describe.

In my don't trust verify attitude, I wanted to understand what the flavors in JAM are and what they do and if the seed phrase and address derivation works as expected. I always do that for new wallets. It was more difficult here, because xpubs were not shown. I could pull it off in the end, but considerable effort was required.

Describe the solution you'd like

Would be good to have a power user mode where users can display xpubs/zpubs for each flavor (account)

editwentyone commented 1 year ago

tank you for the input, afaik we have plans for that: https://www.figma.com/file/kfejZJFlwBywvLEnPEmJo1/JoinMarket-UI?type=design&node-id=4139-77309&t=btiIGZLJOw9L8jKf-11

image
kristapsk commented 1 year ago

Is there JM RPC API call that returns xpubs currently? In any case, I think way forward would be to return output descriptors that Jam could convert to plain xpub, zpub or whatever, if needed.

theborakompanioni commented 1 year ago

Would be good to have a power user mode where users can display xpubs/zpubs for each flavor (account)

This is already partly shown in the Jar details (as shown by @editwentyone). However, only for "deposit" addresses and only always encoded as xpub (as far as I am aware, you need to re-encode it as zpub for some wallets). But you are right, it is currently not possible to show it for the "whole" account (as Jam cannot retrieve this info from JM and it only retrieves the seed phrase to show it to the user - not to infer any keys by itself).

Is there JM RPC API call that returns xpubs currently?

Yes there is: The wallet/{walletname}/display contains this information. However, only for "external addresses" (not the first "internal addresses" branch m/84'/{account}'/0'/1) and it is rather unstructured (within the "branch" property, separated by tabs \t), e.g.

e.g. example response of /display (from a regtest wallet):

{
  "walletname": "Satoshi.jmdat",
  "walletinfo": {
    "wallet_name": "JM wallet",
    "accounts": [
      {
        "account": "0",
        "account_balance": "75.00000000",
        "available_balance": "75.00000000",
        "branches": [
          {
            "branch": "external addresses m/84'/1'/0'/0 tpubDEpNJqC8Ly5knQFgyHTeMR1Kx8KmixYL7ZN5qV8nGxqvKAms5QweeUc6xj9WPsVmv2PbK8pvqEhPdg6tFcrghjsfBEMF2HR9eGknxDSdawS",
            "entries": [
              {
                "hd_path": "m/84'/1'/0'/0/0",
                "address": "bcrt1q00044syeumewv58ntnjklkj7hm2k2rn79lv45m",
                "status": "reused",
                "label": "",
                "extradata": "",
                "amount": "75.00000000",
                "available_balance": "75.00000000"
              },
              [...]
            ],
            "balance": "75.00000000",
            "available_balance": "75.00000000"
          },
          {
            "branch": "internal addresses m/84'/1'/0'/1 ",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          },
          {
            "branch": "internal addresses m/84'/1'/0'/2 tpubDEpNJqC8Ly5kr7vqEEGoTFbaF97LKwDBEY9KtJbXEC9LNGGb1Lui5TJH8vT33A1opgp49Huo7wYV8HRAtACBzvMq6wg8dxeSwFe8FvuXS4r",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          },
          {
            "branch": "internal addresses m/84'/1'/0'/3 tpubDEpNJqC8Ly5kuWRg1EeKf4zE9z5yhvbJyRw4yzKkvNrjphM7zV6ewYX2hNnjSZda2BEe34gdZUT6y6awhZpU9g1roGfcYjUSczR6a9K7gZS",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          }
        ]
      },
      [...]
    ],
    "total_balance": "75.00000000",
    "available_balance": "75.00000000"
  }
}