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

UrXpubQrEncoder always exports for "mainnet" #582

Open
jdlcdl opened this issue Jul 23, 2024 · 1 comment
Open

UrXpubQrEncoder always exports for "mainnet" #582

jdlcdl opened this issue Jul 23, 2024 · 1 comment

Comments

@jdlcdl
Copy link

jdlcdl commented Jul 23, 2024

Exporting XPUB destined for Sparrow appears to export version=mainnet-public even when seedsigner is set for testnet.

As far as I can tell, Sparrow always forces the extended public key to the version matching the network mode that sparrow is running in. This is not causing any problems whatsoever, I'm just logging this as I realized this to be the case while testing for v0.8.0-rc1.

I suspect that if HDKey were initilialized with a non-defaulted "use_info" DataItem, that the resulting "xpub" key might become its "tpub".

self.ur_hdkey = HDKey({ 'key': self.xpub.key.serialize(),

From the Foundation-Devices Passport2 codebase, use_info is initialized like:
https://github.com/Foundation-Devices/passport2/blob/0199ac1488efc894b3d4bb4f55ec2f6884e6491d/ports/stm32/boards/Passport/modules/wallets/casa.py#L37

Discussion 2 days ago in the telegram New Devs group led me to believe that this may better be addressed during the next refactor of qr-encoding code.


An example of a single-sig native-segwit descriptor exported by seedsigner for Sparrow (indicates "zpub" for user) is below:
zpub

  • In Sparrow started with "-n testnet" (or signet), I suspect this gets handled (possibly mangled for testnet mode), creating the following wallet descriptor
wpkh([94613660/84h/1h/0h]tpubDC6QfQdCbyBtfhpJRwBE3zezPCq7ySMBpvxbRmz47dc6K4FJrvBEKfkwYvpPqoJabnf9u9bJZxcELGzF195tQf45S8XNdXsToCBCfWxYN1G/<0;1>/*)#nrhmzuj4
  • In Sparrow started for mainnet, Sparrow notices that the derivation path is suspicious, but interprets the xpub as:
xpub6Bin9AoWthESPudSykC8r5Kd45jTz3r8HJNJ5DvumirCZmabnhL9BE67JtjcKJMLot8FHa5S2rnBe6VdcHEeXDbnNXn4x1DEDEanuXXwQ3C

...and the zpub as:

zpub6qPJkW9MC4KQ6W1geTmPGFWdQ22MsHq87XQje1igXjbxfyD4J1fGRMQPMJenK7fBdAMrnXGYxBVHQfim3g4g7gxz7DAv7prCkgi5gfa1A3q
  • In SeedQReader, this decodes to:
wpkh([94613660/84'/1'/0']xpub6Bin9AoWthESPudSykC8r5Kd45jTz3r8HJNJ5DvumirCZmabnhL9BE67JtjcKJMLot8FHa5S2rnBe6VdcHEeXDbnNXn4x1DEDEanuXXwQ3C)#qkze980s
@fedebuyito fedebuyito mentioned this issue Sep 18, 2024
12 tasks
@fedebuyito
Copy link
Contributor

Hi @jdlcdl , I think I could found way of exporting on testnet for public key from seedsigner. Would be possible to test it on SeedQReader or another tool you have?

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

No branches or pull requests

2 participants