Skip to content

feat(rpc): ability to retrieve xpub/zpub for each account #1586

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

Open
theborakompanioni opened this issue Oct 29, 2023 · 2 comments
Open

feat(rpc): ability to retrieve xpub/zpub for each account #1586

theborakompanioni opened this issue Oct 29, 2023 · 2 comments
Labels

Comments

@theborakompanioni
Copy link
Contributor

There seems to be "problems" with the xpubs contained in the /display response. The extended public keys represent the change "sub-account", e.g. m / purpose' / coin_type' / account' / change instead of m / purpose' / coin_type' / account'. This seems to be done intentionally, so do not see this as a bug report. (But I wonder, how useful they are in practice - keys derived from this are never used by JM, right?)

However, having the xpub/zpub for each mixdepth as distinct property in a response from the api would be awesome. 🙌
Jam wants to avoid to do the calculation on the front end and feed a library with the users seed just to get the extended public key.

Related #1267 ("Enable importing joinmarket wallet as watch-only to mobile wallets").

Any insights on this would be great. What are the downsides of this? Do benefits outweigh them?

@theborakompanioni
Copy link
Contributor Author

theborakompanioni commented Oct 29, 2023

Example wallet-tool.py output:

user@host:/src/scripts# ./wallet-tool.py demo.jmdat
JM wallet
mixdepth	0	fbonds-mpk-tpubDCMAFUjednydKPRZZJj177nEsXHzCYVktf4VZdJd2FpoMVhUrzXnv4EYktXrpss12SZVV7fFkTfPP7vVoxAiBzPUm99QMALXR3Ds9eL2qAc
external addresses	m/84'/1'/0'/0	tpubDDvCuyQC28XttRfpYu9oWeN9jTiGErAuBep6nn4s69xdPEbK9bLvNVipfpXfLYjgA1M5yk7kn5LEipzpJSmaDDQoE5S8VAu27NDjUPhWp4y

Example response from GET /display:

{
  "walletname": "demo.jmdat",
  "walletinfo": {
    "wallet_name": "JM wallet",
    "accounts": [
      {
        "account": "0",
        "account_balance": "0.00000000",
        "available_balance": "0.00000000",
        "branches": [
          {
            "branch": "external addresses\tm/84'/1'/0'/0\ttpubDDvCuyQC28XttRfpYu9oWeN9jTiGErAuBep6nn4s69xdPEbK9bLvNVipfpXfLYjgA1M5yk7kn5LEipzpJSmaDDQoE5S8VAu27NDjUPhWp4y",
            "entries": [...],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          },
         {
            "branch": "internal addresses\tm/84'/1'/0'/1\t",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          },
          {
            "branch": "internal addresses\tm/84'/1'/0'/2\ttpubDDvCuyQC28XtyuBCC7x1wMciYo39NA3nH47akxKSYoEHtQpadL8prDSrdaffg5f7nMPJrw97gEgeBD5F8DbW3rG4YYScwvres9qiLVGL1p9",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          },
          {
            "branch": "internal addresses\tm/84'/1'/0'/3\ttpubDDvCuyQC28XtztYY3tZCZSFF4YeBd4gs1jZndK9GVzJiMTjq3L89LsN3cyd1Dm2gGXojNn4oh7DMVQukcKTgWZ3swRZV7r2gMGyEzewQDaw",
            "entries": [],
            "balance": "0.00000000",
            "available_balance": "0.00000000"
          }
        ]
      },
      {
        "account": "1",
 [...]

@FingerCramp
Copy link

+1
Adding this will allow front ends like JAM to report the xpubs for each jar to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants