joinmarket-clientserver icon indicating copy to clipboard operation
joinmarket-clientserver copied to clipboard

FEATURE: ability to import/recover wallet via rpc

Open Fonta1n3 opened this issue 2 years ago • 6 comments

It would be useful to be able to sync my existing wallet with JM rpc rather than having to create a new wallet.

Fonta1n3 avatar Nov 21 '21 10:11 Fonta1n3

Right; just to note you can open (unlock) an existing wallet file in datadir/wallets but yes, we did not implement the recover mechanism yet, so PRs welcome on this. A pain point however: this requires a call to rescanblockchain so we may have to add that request to the front end, too.

AdamISZ avatar Nov 21 '21 14:11 AdamISZ

Would love to submit a PR but I do not have the Python experience to be comfortable doing so at present.

For background I am adding light client JM functionality to my app Fully Noded (iOS, macOS) which also works with Bitcoin Core as a backend. The UX Id like to build would be to allow users to use an existing seed/wallet from FN to generate a JM wallet with so that they get full JM functionality with their existing familiar wallet, not necessarily a literal JM recovery if that makes sense.

Fonta1n3 avatar Nov 22 '21 01:11 Fonta1n3

Right that can make sense. In that direction, the fact that JM has 5 accounts is fine if the pre-existing wallet uses only account 0, but obviously the other way round can be a problem (unless yours is one of the very few wallets that allows multiple bip32 accounts).

AdamISZ avatar Nov 22 '21 01:11 AdamISZ

@theborakompanioni as far as you're aware, is this still actionable on Joinmarket's side? Perhaps .. a rescanblockchain API call that passes through to Core? It seems a bit weird to do that, but maybe?

AdamISZ avatar Jun 01 '22 16:06 AdamISZ

[...], is this still actionable on Joinmarket's side?

It depends, but I think: Yes.

Perhaps .. a rescanblockchain API call that passes through to Core? It seems a bit weird to do that, but maybe?

In order for it to be useful to an API consumer, a seed phrase must also be able to be passed along, right? As far as I am aware, that is not possible at the moment (see /wallet/create).

If I am not mistaken, some wallets offer to rescan the chain to the point of the "wallet's birthday" (a date the user must provide). It sounds like a reasonable thing to do:

  • Offer a way to create a wallet from seed phrase
  • Offer a way to rescan from a given blockheight/date

Having said that, I think it is not "super urgent", and it should probably be a little more thought out and better planned than I stated here. But overall, it'd be a great feature for any external application.

theborakompanioni avatar Jun 02 '22 11:06 theborakompanioni

Re-reading this half a year later, I can't help but think this is a really necessary improvement. My first thought is to ping @openoms because I presume you did a similar thing in Joininbox (essentially give the user access to rescanblockchain.

Re wallet birthday, see:

https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/d3b62f2a557f1dbdaa370209271c4cc52d5680a1/jmclient/jmclient/wallet.py#L440

... but, after having checked that, I now realize it's irrelevant in recovery :) As you say it must be passed in to whatever the RPC call is going to be.

AdamISZ avatar Jul 01 '22 22:07 AdamISZ

Any update on this? Do you think it is worthwhile to be implemented in the foreseeable future?

theborakompanioni avatar Nov 23 '22 11:11 theborakompanioni

I think the approach of passing an optional seed phrase to create the wallet makes a lot of sense.

Fonta1n3 avatar Nov 23 '22 12:11 Fonta1n3