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

[Feature request] facilitated import of JoinMarket wallets #990

Open
openoms opened this issue Mar 2, 2021 · 4 comments
Open

[Feature request] facilitated import of JoinMarket wallets #990

openoms opened this issue Mar 2, 2021 · 4 comments
Labels
enhancement New feature or request UIUX

Comments

@openoms
Copy link

openoms commented Mar 2, 2021

Background:
Specter Desktop is ideal to manage multiple watch only wallets and construct transactions ready for signing. The Wallets overview is especially helpful to track the global balance and transaction activity.

Since JoinMarket-Org/joinmarket-clientserver@631352c it is possible to sign extrenally prepared PSBTS-s: https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/USAGE.md#co-signing-a-psbt

Issue:
In relation to the JoininBox project openoms/joininbox#26 I am trying to find the best way to quickly import a JM wallet (with it's 5 mixdepth/accounts) to Specter.
The manual process works (especially since JM defaults to native SegWit wallets), but there could be an easier option.
We could either generate an info file to be imported to Specter or there could be an option to simply paste the 5 xpubs to create the JM device and wallets.
Similar to Specter JoinMarket uses a watch only Bitcoin Core wallet to track the chain, so even that could be helpful. Possibly would not even need a rescan if would be able to use the existing wallet? Even the (automatically applied) labels could be kept in that case.
What do you think the best approach would be?

For an example here are the public keys of a sample wallet on signet which I am using for testing: https://termbin.com/yd2k
Xpubs only:

$ python wallet-tool.py signet|grep mixdepth|sed -n '1~2p'|awk '{print $1,$2,$3}'
Enter passphrase to decrypt wallet: 
mixdepth 0 tpubDCqJ97RNYRNeVxzyXHWzYfehVqiJaCDwPRmcFp8a2ScEN8WXU1KzvRgg85CxHT8tq8CYijTubKZtJos3USjUKbwZDWxv3JuySFHUhqBafeB
mixdepth 1 tpubDCqJ97RNYRNeYCQj82eDFmpadSqLZNrJjLXTqUPncEUrnWwP1jzEXtA6zV3CU4h5Q8ZBBXBJdxSGxMqpMhQEQ2rzhXgHcb9Smh8AUQqtwUE
mixdepth 2 tpubDCqJ97RNYRNebUfUFBuLetjqcNguze1S9N9C8cuwViL6ur6Q3Lq3UvBtJvCUB4rkqpFDj7VTpHaYshLj6nkpqoApzXX3k6kYvhDnv2E5u5z
mixdepth 3 tpubDCqJ97RNYRNecxHXqaszJaWYQkfGDZdAMdoXeS8AkaM6LV4c2hr3fUefndmW9wzgA7J8wbAQYjZvxfZqaxro3Sfvn5WtZMLurxGUrXKLgTE
mixdepth 4 tpubDCqJ97RNYRNegb2p3GMMmSHjz5xuNKg63HsnoQKchFCkKADrHKk5ox59hLYJtWY6hMeRCQmHiiTpP3ff4W1W6xjzLCYEERbsYPw8EhzzXaW

Related to this issue as well where the possible future use of Output Descriptors is discussed: JoinMarket-Org/joinmarket-clientserver#558

@openoms
Copy link
Author

openoms commented Mar 2, 2021

After exploring further the existing method is quite user friendly so will share some screenshots here:
Click Add new device:
image
then Manual configuration:
image
Source the master public keys:
Name the wallet, select the Other device type, paste the xpubs and Continue:
image
Looking good:
image
Now Add new wallet, Single key wallet, pick the previously added device.
Will need to do this one-by-one for the 5 mixdepths:
image
With SigNet the balance and transactions show up almost immediately:
image
Once finished the 5 mixdepths show up in the Wallets overview:
image

In summary with the manual configuration it is user friendly already.
Maybe a specific Device type could be introduced for JoinMarket to have the 5 wallets created automatically without going through the manual process 5 times.
Other question if it would be possible to use the watch-only Bitcoin Core to have the labels synchronised?

@ChristopherA
Copy link

BTW, you might want to support add additional requirement for using the latest QR/UR research on crypto-request but for joinmarket. see: https://github.com/BlockchainCommons/Research/blob/master/papers/bcr-2021-001-request.md

Some rough text from a teaser I'm working on:

Before we can create a multisig, we need all the public keys. If the network app is creating the account policy, it also easily creates its own first xpub xpub-A.

Now it needs a second xpub xpub-B from each of the offline devices. The network wallet displays this cypto-request QR code:

Which decodes to:

![](https://i.imgur.com/WaZgHJU.png =400x400)

UR:CRYPTO-REQUEST/OEADTPDAGDOELBEOLPBEPSGTOERDDKPKBYAHWNSNDYAOTAADYKOTADYKAOTAADDYOEADLOCSDYYKADYKAEYKAOYKAXAAAXTAADEHOYAOADTTFRJYSF

This QR UR asks for the offline wallet to give an xpub from any seed under its control, for the [48’/1’/0’/2’] derivation (in this case: multisig, bitcoin, account 0, segwit).

The offline wallet then asks the holder to select a seed to derive the key from, or possibley to create a new seed dedicated to this multisig. Some offline wallets can only support one seed, so it will just ask the holder's consent to share the xpub. It returns this QR:

ur:crypto-response/oeadtpdagdmhzmhdlyaoaeaeaepftdgljladaeaeaeaotaaddlonaxhdclaxtebkfpzmpminjpjngdinrsiatphplkwzmofrspztlrpegeplihonvaenrkhdhseoaahdcxuedybyvytpcscljsgagmpejecsgoenoxghecbdwmbdktfwhfkoutlfvlkslygakgahtaadehoyaoadamtaaddyotadlocsdyykadykaeykaoykaocyhngrmuwzaxaaaycyjtieadltdiutcywf


![](https://i.imgur.com/cioPsod.png =400x400)

Which decodes to:

UR:CRYPTO-HDKEY/ONAXHDCLAXTEBKFPZMPMINJPJNGDINRSIATPHPLKWZMOFRSPZTLRPEGEPLIHONVAENRKHDHSEOAAHDCXUEDYBYVYTPCSCLJSGAGMPEJECSGOENOXGHECBDWMBDKTFWHFKOUTLFVLKSLYGAKGAHTAADEHOYAOADAMTAADDYOTADLOCSDYYKADYKAEYKAOYKAOCYHNGRMUWZAXAAAYCYJTIEADLTLEZSVSLB

Decoding this in CBOR you get a crypt-hdkey:

[604b93f2/48'/1'/0'/2']xpub6ELxvfv7kLAjWvZmfP9rkH4dFrsRJn2JeWfzyzwUsHHTcPKg17ELYMtAu2T8f9H8HQfDWv3g4dsk7yrMY5VJuhreB4JXaTHsZyegqJS1FM6

or in the SLIP-132 form (inproperly IMHO)

tpubDEibSujoTc8Bnikd7a8wxCPzayy5JAXNC9GJLYzdDC3MMfzP5L5RgoZ194XvBeEN5KC88VZYbjhnpALxvwLYo9JwEf3qFyx79wF6bKnukNM

@openoms
Copy link
Author

openoms commented Mar 3, 2021

@ChristopherA thank you, will keep the QRcode format in mind when communicating the publix keys between devices.
Currently my main usecase for the JM wallet in Specter is to open lightning channels with the PSBTs constructed in the Specter GUI. Would not use JM in a multisig setup since it is meant to be a hot wallet and there are funds on mulitple (5) singel sig derivation paths already.

Some added info on the labels in JM from @AdamISZ:
In the watch only Bitcoin Core wallet the JM addresses the "addresses are labelled joinmarket-wallet-XXXXX where XXXXX is basically some intended-to-be-unique truncated hash of the wallet" : https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/365ca38cc2a821039c501b31be264b0ecffaefef/jmclient/jmclient/wallet_utils.py#L313
Then the labels in the JoinMarket wallet like:
cj-out, change-out, non-cj-change, deposit are applied automatically and not even stored in the wallet file currently:
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/jmclient/jmclient/wallet_utils.py#L412

Specter could do a basic transaction analysis like this to apply labels automatically, but it might be out of scope.

Regarding using the already present watch-only Bitcoin Core wallet could Specter filter and import the addresses in the knowledge of the xpub?
Would it makes sense to use the existing Bitcoin Core wallet or does that add too much complication?

@ben-kaufman ben-kaufman added enhancement New feature or request UIUX labels Mar 4, 2021
@kristapsk
Copy link

Then the labels in the JoinMarket wallet like:
cj-out, change-out, non-cj-change, deposit are applied automatically

I would not call them "labels", they are more like statuses, indicating their relationship with incoming transaction(s). Manual address labeling support is something I plan to work on to add to JM in future (mostly to label external receiving addresses I have shared to third parties, to avoid accidental address reuse). But will be stored in JM wallet.jmdat files only likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UIUX
Projects
None yet
Development

No branches or pull requests

4 participants