PIVX-Labs / MyPIVXWallet

Send, Stake and Receive with PIVX's most universal wallet.
https://mypivxwallet.org/
MIT License
29 stars 36 forks source link

Option to import bip39 passphrase along with seed, and other import issues #80

Closed 3point14159 closed 9 months ago

3point14159 commented 1 year ago

Please consider adding this option so that those folk that have set up wallets with the optional bip39 passphrase can use MPW.

-or-

Allow for the master extended private key, found in a wallet dump, to dirive all the many child addresses.

additionally:

Why does the import feature ask for the BTC xprv, but does not allow for the PIVX bip32 root key?

Lastly, is there a way to export the wallet in a format that PIVX core can import and use?

Thanks in advance for reviewing these issues!

3point14159 commented 1 year ago

The use case is taking the "extended private masterkey" from your PIVX core dumpwallet file and then plugging that ("extended private masterkey") into the import wallet option for MyPIVXWallet. Simple, no?

3point14159 commented 1 year ago

Please reply here once this feature becomes available on the unstabble channel. I'll test it.

JSKitty commented 1 year ago

Howdy! Thanks for the support and submission, greatly appreciated. :pray: :purple_heart:

Please consider adding this option that many folk may have set up with other wallets that allow for the optional passphrase.

MPW recommends encryption (via passphrase) for all newly created wallets - it is already optional, but massively recommended; and MPW will refuse to store unencrypted keys on-disk, for security purposes.

Maybe this is in regard to BIP-39 Seed Phrase extension? (i.e: an additional word used for encryption purposes), or something else?

Why does the import feature ask for the BTC xprv, but does not allow for the PIVX bip32 root key?

Currently (to my knowledge) the PIVX Core wallet does not have any easy way to export it's master keys from the UI or CLI: perhaps we could have a "wallet.dat" decoder and import system, but definitely, we want to maintain as much compatibility with ALL PIVX key types and formats as possible, but given MPW is aimed towards "newbs", this needs to be as EASY as possible.

Lastly, is there a way to export the wallet in a format that PIVX core can import and use?

Working on it! MPW has it's own encryption system and uses encrypted "Export/Imports" with a single string, which is the primary method if you've encrypted, we will work on adding an option with Glowing Red warning signs for plaintext master key exports - it's just preferred the average user stays away from handling plaintext keys. :+1:

It would be massively beneficial if you could segregate these in to individual issues - and I'll tag them accordingly with bounties for our team, or external devs to pick up. :pray: :rocket:

3point14159 commented 1 year ago

@JSKitty

"Maybe this is in regard to BIP-39 Seed Phrase extension? (i.e: an additional word used for encryption purposes), or something else?"

Answer: Yes. The encryption passphrase that MPW utilizes isn't the same optional bip39 passphrase you can add to your seedphrase to derive your addresses. See Ian Coleman's bip39 tool for demonstration purposes.

"Currently (to my knowledge) the PIVX Core wallet does not have any easy way to export it's master keys from the UI or CLI"

Yes it does: "dumpwallet" in the console. There are other tools to show this info also. https://iancoleman.io/bip39/

Would love to see a feature where MPW exports can be seamlessly imported into the native PIVX core program. Seems like this should be a main feature...

JSKitty commented 1 year ago

Got it! Yep, standardising encryption is a good idea - MPW had this encryption style prior to integrating BIP-39, so it's a bit of a "remnant" of the old wallet system.

Yes it does: "dumpwallet" in the console. There are other tools to show this info also.

Right; but this isn't an optimal method, for ease or security, I dislike the idea of having users touch unencrypted keys and/or files, this is the total opposite of MPW's approach (Ease and Security fore-forth to 'advanced' lesser-used features).

The primary encrypted wallet.dat would be great; but is a lot of work to integrate, considering we'd need to read (and even write) the same BDB database formatting.

Anyway, not saying this won't be integrated, but it's arguably low priority, from the angle of adoption and onboarding.

Would love to see a feature where MPW exports can be seamlessly imported into the native PIVX core program.

I agree - it just needs to remain secure. Once unencrypted keys touch your disk, especially for the average non-savvy user, they have likely voided the security of all of the encryption we employ.

3point14159 commented 1 year ago

@JSKitty looks like it is in the works to being integrated in the next wallet release:

https://github.com/PIVX-Project/PIVX/pull/2785#issuecomment-1416832048

bip39 is pretty stable (old) and standardized for most other wallets. PIVX is behind the curve by not incorporating this feature sooner and would become competitive with the other options in this space by releasing a version bump to include bip39. Then it would make your import feature much more simple for us Pivians.

JSKitty commented 1 year ago

Indeed! (It is actually members of the PIVX Labs - MPW team - integrating this feature in to PIVX Core, a-la @panleone and @Duddino! :purple_heart:).

And I fully agree, PIVX is far behind in many of these areas - including MPW even, but this is what we're working HARD to fix, if you check the past 3 months of commits, we have integrated HD, BIP39, Masternodes/Governance, etc, so we're moving as fast as our team is capable of, to bring PIVX to modern standards. :pray:

3point14159 commented 1 year ago

@JSKitty I gave some thanks to the efforts they've made thus far, seems like it's all coded-up now; would love to beta test it! Maybe about time for a release candidate...

With full native implementation of bip39, the mission of preserving ease and security will be achieved with greater simplicity compared to restore options available right now. Looking forward to seeing this take shape soon!

3point14159 commented 1 year ago

Thanks for adding this to the project roadmap!

Duddino commented 1 year ago

Please consider adding this option so that those folk that have set up wallets with the optional bip39 passphrase can use MPW.

I can work on this

Allow for the master extended private key, found in a wallet dump, to dirive all the many child addresses.

Isn't this already implemented?

Why does the import feature ask for the BTC xprv, but does not allow for the PIVX bip32 root key?

PIVX core derives keys in a way that is incompatible with how a light wallet does it, you could implement it, but it would be inefficient as you would have to manually derive addresses.

3point14159 commented 1 year ago

Excellent work with this issue @Duddino, @panleone, and @JSKitty! BIP39 implementation works, tested it myself. Hardware wallet words well too. One last part that I want to see if we can make happen...

So, if you do a RPC:walletdump of the PIVX core wallet, you get a "extended private masterkey" . Is there a way to import it and and read the addresses with balances? That would allow you to send/sign transactions. On the other hand, and more preferably; is there a way to export any sort of "extended public masterkey" from the core wallet and then import it into MPW for watch only?

MPW is really putting the control back in user's hands, thanks again for expanding the functionality with style. Everything is shaping-up beautifully. Is there any way I can interview any of the devs here about the recent features? I can send my questions ahead of time so we can provide the listeners with a quality report.

panleone commented 1 year ago

Excellent work with this issue @Duddino, @panleone, and @JSKitty! BIP39 implementation works, tested it myself. Hardware wallet words well too. One last part that I want to see if we can make happen...

So, if you do a RPC:walletdump of the PIVX core wallet, you get a "extended private masterkey" . Is there a way to import it and and read the addresses with balances? That would allow you to send/sign transactions. On the other hand, and more preferably; is there a way to export any sort of "extended public masterkey" from the core wallet and then import it into MPW for watch only?

MPW is really putting the control back in user's hands, thanks again for expanding the functionality with style. Everything is shaping-up beautifully. Is there any way I can interview any of the devs here about the recent features? I can send my questions ahead of time so we can provide the listeners with a quality report.

There is one main problem of why we "cannot" use same derivation path of PIVX Core (we can but it would slow down A LOT the sync time): PIVX Core uses hardened keys (more info here https://en.bitcoin.it/wiki/BIP_0032)

3point14159 commented 1 year ago

@panleone Thanks for the reference, just skimmed through it. So okay, no import "extended private masterkey", but is there any "extended public masterkey" a user could export for watch only? I didn't see anything in the RPC documentation that does this. You can watch your xpub master seed from a BIP39 generated address on a block explorer, but not PIVX core/HDwallets.

*see links

Duddino commented 1 year ago

No, because child keys are derived as hardened keys (In PIVX core), you can only watch your whole balance if you have the private key too

3point14159 commented 1 year ago

@Duddino & @panleone I think I see now. So the watch xpub feature on the block explorers really cannot be used with core wallets (since they cannot export an xpub). That seems to be a BIP39 exclusive feature, if I am understanding right.(?)

3point14159 commented 1 year ago

@Duddino @panleone @JSKitty Will a wallet created/generated with MPW be interchangeable with PIVX Core (meaning importing your MPW seedphrase + password) when PIVX Core version 6 releases? Likewise, will wallets generated by PIVX Core be wholly and easily imported into MPW? If not, that should make it onto the roadmap (if possible). Thanks for the code.

Duddino commented 1 year ago

As stated previously, that will not be possible.

3point14159 commented 1 year ago

@Duddino Thanks for the follow-up. Basically, the only way to import from one to the other is by importing WIF privkey. Although, that isn't generally recommended for security reasons, no?

Duddino commented 9 months ago

Closing as implemented