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

Any plans to support p2wsh version bytes (with custom derivation path)? #351

Closed
mflaxman opened this issue Aug 31, 2019 · 9 comments
Closed

Comments

@mflaxman
Copy link

I'm writing a guide for multi hardware wallet multisig, and right now the best option for that is (unfortunately) Electrum. I love this tool you've built, and I'd like to recommend incorporating it for generating one key of a multisig to keep offline as an emergency recovery option. As you may know, the extended pubkeys generated with this tool are not compatible with electrum's segwit multisig implementation :(

Here is the workaround I've come up with:

  1. Generate seed on this site
  2. Click BIP32 tab
  3. Enter custom derivation BIP32 derivation path m/48'/1'/0'/2' (for native segwit)
  4. Copy the resulting BIP32 Extended Public Key
  5. Paste that xpub/tpub into https://jlopp.github.io/xpub-converter/ and select p2wsh.
  6. Copy the resulting Zpub/Vpub into electrum.
  7. Save the seed offline (paper, cryptosteel, USB drive, etc)

This does work, but the UX is awful and the risk of mistakes for average users is high. Instead, I have to recommend they use regular old P2SH (with custom BIP32 derivation path m/45'/0). To clarify, I'm asking if you'd be open to adding the version bytes in SLIP-0032.

If we want all our seeds to be BIP39 (best practice) we could recommend a user could just paste their BIP39 seed from this site into electrum and generate a Zpub/Vpub that way, but I'm worried about them then properly destroying the seed. Your site is easy enough for regular users to be able to run offline and delete afterwards.

It'd be great to also have an option for p2sh wrapped segwit (p2wsh-p2sh), but that's less important vs p2wsh. If you're open to it, the "Script Semantics" dropdown on the BIP141 tab is a nice UI option.

Thanks!

@iancoleman
Copy link
Owner

Thanks for this. Sounds good, I'll look into including this in the next release, it's a good feature to have.

@mflaxman
Copy link
Author

mflaxman commented Sep 2, 2019

Awesome, that would be super cool! Looking forward to it.

Any timeline? I know estimates are the worst :)

@mflaxman
Copy link
Author

Any update on this? Thanks!

@iancoleman
Copy link
Owner

I've implemented this but when I tried to import Zpub to electrum to test compatibility it gave an error

This is Zpub for abandon abandon ability network BTC - Bitcoin derivation path m/0

Zpub6z87Hz4evmmy4ZWZCk3DHM9BkgJE5b7suj9fr2n28n7h76FFyQPScSz8rYmBaKZgggPSofEKxVRPkKCy8m2wnDE8ETKH6TPUv3A8tvu4ZwX

Steps in electrum 3.3.8:

  • Create new wallet
  • Standard wallet
  • Use a master key
  • Paste Zprv or Zpub or Yprv or Ypub
  • Get error "Wrong key type p2wsh"

Can you please let me know the steps to import these extended keys to electrum so I can check address generation is consistent?

Also I'm curious about your derivation path purpose being 48... where does that come from since the bips repository doesn't have a bip48?

@mflaxman
Copy link
Author

I think for p2wsh you need to select "Multi-signature wallet" and not "Standard wallet" in Electrum:

Screen Shot 2019-12-15 at 6 14 58 PM

FWIW, I think their wording is confusing and has misled others before.

Does that work?

@iancoleman
Copy link
Owner

Electrum only allows multisig with 2 participants, and this tool only deals with 1 extended key, so I still have a problem of verifying this tool output with a third party tool. I was hoping to generate a 1-of-1 address and use the electrum value as an alternative / test / comparison for this tool.

Any tips on how to use a third-party tool for verification / testing of this feature in the context of this tool?

See TODOs in 5c203fa

@mflaxman
Copy link
Author

Awesome!

Some potential test vectors you could include:
https://github.com/satoshilabs/slips/blob/master/slip-0132.md

Another way would be to confirm the output matches the workaround steps above (#351 (comment)). I just compiled your latest and confirm that worked, so that's exciting!

Alternatively, this is also manual but could work?:

  1. Generate 2 seeds (for 1-of-2) using your tool
  2. Create a watch-only Electrum wallet by pasting both of the Vpub/Zpubs into Electrum
  3. Generate address and test receiving funds
  4. Create new 1-of-2 Electrum wallet, but this time use one of the BIP39 seeds from your tool and a Vpub/Zpub for the other key.
  5. Test spending those funds.

@iancoleman
Copy link
Owner

f7e9fdf

@iancoleman
Copy link
Owner

Decided to go with 1-of-1 multisig for these addresses.

f7e9fdf - Generate addresses for P2WSH and P2WSH-P2SH

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