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

Display the account xpub in QT interface #1266

Merged

Conversation

BitcoinWukong
Copy link
Contributor

@BitcoinWukong BitcoinWukong commented May 11, 2022

The account xpub is available when you run python wallet-tool.py wallet.jmdat, but it's not available in the QT interface.

This PR shows the account xpub in the QT interface as well so that users can also access it from joinmarket-qt.

@kristapsk
Copy link
Member

Should add "copy extended public key to clipboard" to the context menu for this new xpub too.

@kristapsk
Copy link
Member

Now that #1265 is merged, also "show QR code" should be added.

@BitcoinWukong
Copy link
Contributor Author

Should add "copy extended public key to clipboard" to the context menu for this new xpub too.
Now that #1265 is merged, also "show QR code" should be added.

PR updated, both issues are addressed, PTAL, thanks!

@BitcoinWukong
Copy link
Contributor Author

Just made another update to address the display of a "fbond-xpub".
This PR is now ready for review.

scripts/joinmarket-qt.py Outdated Show resolved Hide resolved
parsed = txt.split()
if len(parsed) > 1:
if parsed[-1].startswith("xpub") or parsed[-1].startswith("ypub") or parsed[-1].startswith("zpub"):
xpub = parsed[-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the pre-existing code (relying on "EXTERNAL" and list position of the xpub) and your new code (relying on having a list of items more than 1 and that the final one is where the xpub is stored, and also the repeated check for [x,y,z]pub which I think could be abstracted) are a bit brittle in how they assume the structure of the tree items we're creating.

I don't think there's anything actually wrong though. Also a lot of the code in this script is like that, anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(You could just get rid of repeated startswith with if any([parsed[-1].startswith[prefix] for prefix in ["xpub",...]]) as one simplifier, and/or push out the list of *pub strings somewhere else)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's anything actually wrong though. Also a lot of the code in this script is like that, anyway.

Going to eventually update the is_extended_public_key method to perform the base58 decoding and compare the check sum. Probably in a following up PR after this one.

scripts/joinmarket-qt.py Outdated Show resolved Hide resolved
@AdamISZ
Copy link
Member

AdamISZ commented May 14, 2022

Tested QR code read and copy-paste to clipboard successfully on Qt.

So provisional tACK , just, as per comments, whitespace and also probably should handle tpub somehow.

@BitcoinWukong
Copy link
Contributor Author

@AdamISZ , comments addressed, PTAL, thanks!

@@ -50,6 +55,12 @@ def detect_script_type(script_str):
raise EngineError("Unknown script type for script '{}'"
.format(bintohex(script_str)))


def is_extended_public_key(key_str):
return any([key_str.startswith(prefix) for prefix in [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more robust check would be doing a base58 decoding check here.
But I don' think that has to be part of this PR now.

@AdamISZ
Copy link
Member

AdamISZ commented May 24, 2022

I think after another round of testing, I'm happy to add tACK and will merge, however:

you've removed the fbonds-mpk string from the extended public key of the 0 account for fidelity bonds. What's your reasoning? @chris-belcher afaiu added this specifically so there was some marker allowing imports/exports of this account to recognize the existence of Joinmarket fidelity bonds (i.e. needing to be scanned).

@AdamISZ AdamISZ merged commit 5b38ea5 into JoinMarket-Org:master May 24, 2022
@BitcoinWukong BitcoinWukong deleted the wukong--display-account-xpub branch June 5, 2022 08:21
@BitcoinWukong
Copy link
Contributor Author

you've removed the fbonds-mpk string from the extended public key of the 0 account for fidelity bonds. What's your reasoning

This fbonds-mpk is a joinmarket specific prefix and isn't recognized by any other wallets. If we do not remove this prefix, no other wallet could import the xpub.

I guess a better solution might be we give the user an option to show/hide this prefix base on their own need.

@AdamISZ
Copy link
Member

AdamISZ commented Jun 6, 2022

This fbonds-mpk is a joinmarket specific prefix and isn't recognized by any other wallets. If we do not remove this prefix, no other wallet could import the xpub.

Right, it probably seems like a silly question except: if a person did actually have any timelocked funds in that mixdepth, and they tried to import it somewhere else, or another Joinmarket read-only setup (if that were possible yet), the timelocked funds would not be shown.

I guess a better solution might be we give the user an option to show/hide this prefix base on their own need.

Yeah I guess that could make sense. I'm just not sure exactly what should be done here.

@BitcoinWukong
Copy link
Contributor Author

Right, it probably seems like a silly question except: if a person did actually have any timelocked funds in that mixdepth, and they tried to import it somewhere else, or another Joinmarket read-only setup (if that were possible yet), the timelocked funds would not be shown.

So for the time being, I'm only dropping the prefix and converting the xpub to ypub/zpub in QT interface. When the user run wallet-tool.py, it still shows the xpub format with the prefix.

Not a perfect solution, but at least this way the user can have both format available to them.

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

Successfully merging this pull request may close these issues.

None yet

3 participants