spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.39k stars 3.08k forks source link

implement advanced wallet option: multiple xpubs, mixed script types, and similar (maybe with output script descriptors) #6016

Open SomberNight opened 4 years ago

SomberNight commented 4 years ago

Currently HD wallets created by Electrum are severely limited:


I think it would be really nice if there was an option to create an advanced wallet; a power user feature. This wallet could not be restored from seed.

It would allow importing xprvs/xpubs: so the user could have multiple of these. Importing could even be allowed for existing wallets (not just in wizard at creation time). These could have differing script types associated with them.

I think even single privkeys/addresses could be allowed to be imported.

Perhaps the user could mark certain paths to be preferred to be given out as receive addresses, and others as preferred change.

Maybe this would be best implemented after support for output script descriptors (https://github.com/spesmilo/electrum/issues/5694), as those seem useful for creating this advanced wallet; and actually the other direction too: output script descriptors seem a lot more useful if such an advanced wallet can be created.


The wallet could just be a list of output script descriptors, maybe even allowing mixing single addresses and HD descriptors, and optionally "attaching" hardware devices to these descriptors. No more distinction between imported/deterministic wallets: everything could be a list of descriptors - just one wallet type. Well, maybe except for seeded wallet: which would maybe be a subclass of descriptor wallet.

jonjonez commented 8 months ago

Certainly, if this release occurs with all these features mentioned, it would be great. I hope you take into consideration what I mentioned in #8879 , and adding:

For a newbie, the easiest and safest thing to do is to sweep the private key. As an advanced user, you can create an imported wallet, and use pay-to-multi (batched payment) where you directly pay whatever amount you want to whomever and also send the rest to a change address in your other (HD) wallet.

Sweeping a private key is not viable in times of congested mempool, in addition, the user may have several reasons for just wanting to import instead of sweep. Please take this into consideration.

I know about pay-to-multi, but doing this manually is not viable, it would be nice if this was automatic in the wallet (considering if the private key was imported into the existing keypair).

Currently I can import private keys by creating a new file just for imported keys, there is a change address option to select, then the wallet sends the remaining balance to the next address added as change, but this is not satisfactory, because in an imported wallet I I can only add private keys, that is, if I want to add only addresses to this file without revealing the private key to use it as change I can't, I have to import the private key, and this address of mine can be used as cold storage, but then it will no longer be cold storage because I'd have to reveal the private key, this is insecure and exposes me to risk without any need.

Wouldn't it be easier or no longer distinguish between private keys and watch-only addresses when creating a new file just to import new addresses and/or private keys than one just for private keys and the other just for watch-only, do you understand my point?

Or import directly into the existing keypair of an HD wallet, and if you find this insecure due to the possibility of an inexperienced user losing funds by deleting either the imported private key or the HD wallet, then consider adding a command in the console.