feat(rpc): ability to retrieve xpub/zpub for each account
Opened this issue · 1 comments
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?
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",
[...]