Bitcoin Forum

Bitcoin => Electrum => Topic started by: Sidney986 on October 30, 2021, 08:10:16 PM



Title: Curious Question
Post by: Sidney986 on October 30, 2021, 08:10:16 PM
Curious question.

I understand the importance of keeping seed words to recreate wallets but,

If I had the 2 private keys to a electrum multisig wallet but no seed words to recreate the wallets, could I still send the funds from the multisig wallet using those 2 private keys.  The addresses of the private keys are different in a multisig wallet due to the combination of the private keys that created them, so that is why I ask.



Title: Re: Curious Question
Post by: BlackHatCoiner on October 30, 2021, 08:16:16 PM
It'd be the same if you didn't keep the seed phrase, but only the private key of one non-multi-sig address. You could still, obviously, spend money from it. Same happens if you had the two private keys of an address from a 2-of-2 multi-sig wallet.

Generally, the seed phrase isn't necessary at all. It's just an easy way to recover your funds. Once you sign a transaction, which is how you spend bitcoins, you don't use any seed phrases, but only the private key(s).


Title: Re: Curious Question
Post by: BitcoinGirl.Club on October 30, 2021, 08:45:18 PM
Generally, the seed phrase isn't necessary at all. It's just an easy way to recover your funds. Once you sign a transaction, which is how you spend bitcoins, you don't use any seed phrases, but only the private key(s).
Electrum is crashing.
When I am trying with p2wsh: in Import Bitcoin addresses or private keys in the next screen I see the error. It is asking me to Send Bug Report but when I am trying without p2wsh: then I get a legacy address which is obviously not the multi-sig address I have.

I was trying in a multi-sig segwit wallet.

So how would I give the input that I need to recover p2wsh address?


Title: Re: Curious Question
Post by: o_e_l_e_o on October 30, 2021, 08:45:46 PM
If I had the 2 private keys to a electrum multisig wallet but no seed words to recreate the wallets, could I still send the funds from the multisig wallet using those 2 private keys.
Yes, as BHC has explained above, but you need to be sure you have backed up the correct two private keys. You would need to back up both private keys from a specific individual multi-sig address to be able to recover the funds from that one address (but not the rest of the wallet), or you would need to back up both master private keys to be able to recover the entire wallet.

Also note that this would only work for a 2-of-2 wallet. If you had a 2-of-3 wallet (or any number greater than 2, for that matter), you would also need at least the public keys from all the other shares.



-snip-
You cannot recover a multi-sig wallet by importing private keys from one of the shares in to a brand new wallet like that. To generate the multi-sig addresses, Electrum needs information from all the shares simultaneously. You need to instead select the multi-sig option, select your m-of-n set up, and then choose to import private keys on that screen.


Title: Re: Curious Question
Post by: Charles-Tim on October 30, 2021, 08:56:45 PM
The most important reason the seed phrase is existing is because it can generate the seed, the seed generates the master private key, the master public key and master chain code wich is a one way function through HMAC-SHA 512. So the seed phrase is existing to generate the master private key which is enough to generate the keys and addresses.

So, the master private keys can reconstruct the wallet, you have nothing to be worried about, but seed phrases are easy to backup if compared to the master private keys.


Title: Re: Curious Question
Post by: BlackHatCoiner on October 30, 2021, 09:01:36 PM
When I am trying with p2wsh: in Import Bitcoin addresses or private keys in the next screen I see the error.
It seems that you can't have a non-HD multi-sig wallet in Electrum. In order to create/import one, you're forced to go on Multi-signature wallet which will then either ask you to enter a seed phrase or a master key.

But, even if it didn't have this limitation, how would you import the private keys of a multi-sig address? Like, write what? Bunch of private keys? If you wrote four private keys how would it know that it's a 4-of-4 instead of 3-of-4? And that's just if it only supported one address in each importation.


Title: Re: Curious Question
Post by: hosseinimr93 on October 30, 2021, 09:08:25 PM
If I had the 2 private keys to a electrum multisig wallet but no seed words to recreate the wallets, could I still send the funds from the multisig wallet using those 2 private keys.
To be able to import the wallet into electrum, you need two master private keys.
Electrum allows you to create a multi-signature wallet from master private keys. But it doesn't allow you to create a multi-signature address from individual private keys.
If you have individual private keys, you can use coinb.in (https://coinb.in/#newMultiSig).


Title: Re: Curious Question
Post by: HCP on October 30, 2021, 09:15:28 PM
I was trying in a multi-sig segwit wallet.

So how would I give the input that I need to recover p2wsh address?
You can't create single address MultiSig wallets in Electrum importing singular private/public keys. You can only create "HD" wallets using Master Private/Public keys... and only by using the "New/restore -> Multi-signature wallet" option during wallet creation.

To do what you're attempting to do, you'd need to use something like Bitcoin Core and the createmultisig command. I've done this in the past (non-SegWit) with Bitcoin forks like Bitcoin Cash and Bitcoin Gold to extract fork coins from 2FA wallets.


Title: Re: Curious Question
Post by: o_e_l_e_o on October 30, 2021, 09:29:31 PM
It seems that you can't have a non-HD multi-sig wallet in Electrum.
You can generate individual multi-sig addresses from individual private keys, it's just that you have to use the console rather than the GUI, and the whole thing is a bit clunky. Much better to just back up your seed phrases (or at least your master keys) instead.

If we take the following three private keys for example:

Code:
58BA66C5DC6C02DD3B00439E245046FA0329AC0FD61AF50EA774BF89C02F9D60
58BA66C5DC6C02DD3B00439E245046FA0329AC0FD61AF50EA774BF89C02F9D61
58BA66C5DC6C02DD3B00439E245046FA0329AC0FD61AF50EA774BF89C02F9D62

We would then calculate the three corresponding public keys:

Code:
039e14cb6b0dc8b2d2a072ac3c9f9913f9e7c4a76d071f977f3c0a549d328d35b1
0276bd98401b5f6279c131458f3b73498c904d22b9bf6247fd712cd4a18cb5e000
0301ff4016b35fdf19839a4fb78205e96725bc1b5547a9d494f2a21cd31827b1f5

So then in the Electrum console, we would use the following command to create a 2-of-3 address using those three public keys:

Code:
createmultisig(2, ["0276bd98401b5f6279c131458f3b73498c904d22b9bf6247fd712cd4a18cb5e000", "0301ff4016b35fdf19839a4fb78205e96725bc1b5547a9d494f2a21cd31827b1f5", "039e14cb6b0dc8b2d2a072ac3c9f9913f9e7c4a76d071f977f3c0a549d328d35b1"])

Which will create the following multi-sig address:

Code:
3FK3xTDPigWMQDVFEPNBTEmPoJVG3c5zrW

Note that we should order the public keys lexicographically as per BIP45.


Title: Re: Curious Question
Post by: Sidney986 on October 30, 2021, 10:04:11 PM
Thanks for all the replies.

I tend to make backups of all private keys on a air gapped computer and store them on memory cards that will only ever see the light of day in an emergency should I have issues with wallet software and can't resolve issues via the seed words.  Just call me paranoid.

So from what I gather electrum or other software will allow the recreation of a multisig wallet via the use of both "master private keys" as long as the wallet is a 2 of 2 setup and no more. 

Thank you.



Title: Re: Curious Question
Post by: hosseinimr93 on October 30, 2021, 10:16:06 PM
I tend to make backups of all private keys on a air gapped computer...............
What do you mean by "all private keys"?
If you mean the private keys electrum gives you if you select "Wallet" > "Private keys" > "Export", note that they can't be used for recovering a multi-signature wallet.

You must back up the seed phrases or the master private keys.


Title: Re: Curious Question
Post by: BitMaxz on October 30, 2021, 11:19:16 PM
~snip~

Take note private key and master private key are different.

Base on List of Bitcoin address prefixes (https://en.bitcoin.it/wiki/List_of_address_prefixes) this below are a sample of WIF private key compress or uncompress

Code:
5TfQjD9DLFeUFmDiDrzsdtSGQss93o4pvsmQcgmjfcQVLsEgAoM
L1aW4aubDFB7yfras2S1mN3bqg9nwySY8nkoLmJebSLD5BWv3ENZ
KyN4pEfhTKwiMXzsTcpwhLcb6oBqVF9BfzxhNexvGdFiU6JC5kxe

then this below is the master private keys that start with xprv,yprv and zprv

Code:
xprv9s21ZrQH143K24Mfq5zL5MhWK9hUhhGbd45hLXo2Pq2oqzMMo63oStZzF93Y5wvzdUayhgkkFoicQZcP3y52uPPxFnfoLZB21Teqt1VvEHx
yprvAEESwmtyMr98rt1nMM5qT65puefpgouLjVuZtVDBGr4AG8eFvcb7TU9wLAY4t1Fz2HNvexHEGoGA8xJkbQDp5DK3DWbtHpQdMQJEJW7wug2
zprvAfecm94GeBrDyvzNoh8FEiKTkmoTE7Fzyb6w4a7yGXvhaBQpjFZA25FjufNRRNC63ynG4DPeaVMchXEwKZBoTMBc4JFe51K6tmPRennyHWc

Now if you want to backup all of your private keys then a single master private key or seed should be enough to handle all private keys from your wallet.



Title: Re: Curious Question
Post by: hosseinimr93 on October 31, 2021, 12:01:31 AM
Now if you want to backup all of your private keys then a single master private key or seed should be enough to handle all private keys from your wallet.
OP is talking about a multi-signature wallet and a single master private key isn't enough for recovering the wallet.

Assuming the wallet is 2 of 2, two master private keys are needed.
Assuming the wallet is 2 of 3, two master private keys and one master public key are needed.


Title: Re: Curious Question
Post by: nc50lc on October 31, 2021, 03:00:48 AM
So from what I gather electrum or other software will allow the recreation of a multisig wallet via the use of both "master private keys" as long as the wallet is a 2 of 2 setup and no more.  
Electrum can recreate a 2-of-3, 3-of-5 or more as long as you have the "master public key(s)" or "master private key(s)" of the remaining cosigners (m-of-n).
Eg. For 2-of-3, if you already have 2 master private keys, you'll only need the other cosigner's master public key or master private key to recreate the wallet.

If I had the 2 private keys to a electrum multisig wallet but no seed words to recreate the wallets, could I still send the funds from the multisig wallet using those 2 private keys.  The addresses of the private keys are different in a multisig wallet due to the combination of the private keys that created them, so that is why I ask.
Take note that even if this is possible in the console as mentioned, it's currently useless in Electrum since it's not automatically imported and Electrum can't sign a multisig unsigned txn via console
because there's no option to add the redeem script on its 'signtransaction' and 'signtransaction_with_prvkey' commands.
At least it may be implemented in the future (/electrum/issues/5694 (https://github.com/spesmilo/electrum/issues/5694#:~:text=e.g.%20importing%20and%20spending%20from%20p2pk%20scripts%2C%20or%20non-HD%20multisig%20scripts.)) or it can be used in Bitcoin Core (or other clients like coinb.in) if an issue occurred with the seed phrases.

You're thinking about the long term, I see.


Title: Re: Curious Question
Post by: o_e_l_e_o on October 31, 2021, 07:41:34 AM
So from what I gather electrum or other software will allow the recreation of a multisig wallet via the use of both "master private keys" as long as the wallet is a 2 of 2 setup and no more.
Correct.

then this below is the master private keys that start with xprv,yprv and zprv
For Electrum multi-sigs, the master private keys will begin with "Zprv" (and the master public keys with "Zpub"). Note that the capitalization of the Z is important. If you try to recover a multi-sig wallet in Electrum using xprvs, yprvs, or zprvs, you will get a "Wrong key type" error.


Title: Re: Curious Question
Post by: BitcoinGirl.Club on October 31, 2021, 12:45:38 PM
It seems that you can't have a non-HD multi-sig wallet in Electrum. In order to create/import one, you're forced to go on Multi-signature wallet which will then either ask you to enter a seed phrase or a master key.
I usually go with seed phrase for HD wallet. Never gave a try until yesterday with a single private key. Now it sounds like a lot of work to do with Electrum for a single private key.

Assuming the wallet is 2 of 2, two master private keys are needed.
Assuming the wallet is 2 of 3, two master private keys and one master public key are needed.
Consider x of y. You basically need x master private keys to send any coin from the wallet.


Title: Re: Curious Question
Post by: hosseinimr93 on October 31, 2021, 01:04:09 PM
I usually go with seed phrase for HD wallet. Never gave a try until yesterday with a single private key. Now it sounds like a lot of work to do with Electrum for a single private key.
That's very easy if the wallet is not multi-signature. You only need to add a prefix to specify the address type. 
When dealing with a multi-signature address, it's not possible to create it using a single private key even with a lot of work.


Consider x of y. You basically need x master private keys to send any coin from the wallet.
You need x master private keys and (x-y) master public keys.


Title: Re: Curious Question
Post by: BitcoinGirl.Club on November 01, 2021, 01:40:41 PM
That's very easy if the wallet is not multi-signature. You only need to add a prefix to specify the address type.
Not a coder and not good at algorithm too. I think the Electrum developers do not have a method to execute p2wsh type yet. So with this prefix the software is crashing. It does not disappear but ask you to report. So they already have the event handler in place.


Title: Re: Curious Question
Post by: pooya87 on November 02, 2021, 04:15:28 AM
That's very easy if the wallet is not multi-signature. You only need to add a prefix to specify the address type.
Not a coder and not good at algorithm too. I think the Electrum developers do not have a method to execute p2wsh type yet. So with this prefix the software is crashing. It does not disappear but ask you to report. So they already have the event handler in place.
Electrum does support P2WSH scripts, you can easily create SegWit multi-signature wallets with Electrum that use this script type. However, there is no prefix for it when importing a private key because it makes no sense since P2WSH scripts are created using a redeem-script not a single key like P2WPKH for example.

For example you create it by hashing the following script:
Code:
OP_2 <pub1> <pub2> <pub3> OP_3 OP_CHECKMULTISIG
As you can see you can't even reproduce this script with a single private key.


Title: Re: Curious Question
Post by: BitcoinGirl.Club on November 02, 2021, 01:25:38 PM
However, there is no prefix for it when importing a private key because it makes no sense since P2WSH scripts are created using a redeem-script not a single key like P2WPKH for example.

For example you create it by hashing the following script:
Code:
OP_2 <pub1> <pub2> <pub3> OP_3 OP_CHECKMULTISIG
As you can see you can't even reproduce this script with a single private key.
This makes sense now. Well let's not make it too hard. We always have option to deal with the HD wallet. I don't think anyone need to access only a single public key when it's x to y multi-sig wallet.


Title: Re: Curious Question
Post by: HCP on November 03, 2021, 02:09:09 AM
This makes sense now. Well let's not make it too hard. We always have option to deal with the HD wallet. I don't think anyone need to access only a single public key when it's x to y multi-sig wallet.
The only time I've had this requirement was when trying to "rescue" fork coins from Electrum MultiSig and/or 2FA wallets, for which a "forked" version of Electrum supporting MultiSig and/or 2FA was not available... and that hasn't really been an issue for years now.

But basically, it involved taking the master keys... identifying the individual private keys that matched the addresses with UTXOs... then essentially recreating the multisig in the "Core" wallet for the particular chain.

It's not impossible to do... it's just a real PITA and requires quite a bit of manual work/console stuff with raw transactions etc. (not to mention having to sync/maintain multiple chains ::))


Title: Re: Curious Question
Post by: pooya87 on November 03, 2021, 04:59:41 AM
~
This makes sense now. Well let's not make it too hard. We always have option to deal with the HD wallet. I don't think anyone need to access only a single public key when it's x to y multi-sig wallet.
Yeah you don't need to work with a single public key if it was used in a multi-sig scheme since that would be useless, but also unfortunately importing a lone multi-sig address with having all the keys is not an available option in Electrum. An old open issue (https://github.com/spesmilo/electrum/issues/5535) tracks this but hasn't been solved yet.


Title: Re: Curious Question
Post by: BitcoinGirl.Club on November 03, 2021, 03:12:31 PM
It's not impossible to do... it's just a real PITA and requires quite a bit of manual work/console stuff with raw transactions etc. (not to mention having to sync/maintain multiple chains ::))
I had extracting fork coin thing in mind but then realized who care about few shitcoins LOL. I prefer long-term hold in an x by y multi-sig wallet.

An old open issue (https://github.com/spesmilo/electrum/issues/5535) tracks this but hasn't been solved yet.
I think the answer is here (https://bitcointalk.org/index.php?topic=5368408.msg58325614#msg58325614) which you already talked about.


Title: Re: Curious Question
Post by: Kakmakr on November 11, 2021, 01:35:10 PM
Thanks for all the replies.

I tend to make backups of all private keys on a air gapped computer and store them on memory cards that will only ever see the light of day in an emergency should I have issues with wallet software and can't resolve issues via the seed words.  Just call me paranoid.

So from what I gather electrum or other software will allow the recreation of a multisig wallet via the use of both "master private keys" as long as the wallet is a 2 of 2 setup and no more.  

Thank you.



SD standards-based memory cards, like most semiconductor cards, store information in flash memory. The current technology along with normal usage typically gives the card a lifespan of 10 years or more, allowing consumers to upgrade their devices for many years and reduce consumer electronic waste. Source : https://www.sdcard.org/consumers/faq/

So you should replace your memory cards and move the data onto the new memory cards to protect that data. Some people are saying these cards only hold the data for about 5 years.  ::)


Title: Re: Curious Question
Post by: nc50lc on November 12, 2021, 02:14:31 AM
-snip-
SD standards-based memory cards, like most semiconductor cards, store information in flash memory. The current technology along with normal usage typically gives the card a lifespan of 10 years or more, allowing consumers to upgrade their devices for many years and reduce consumer electronic waste. Source : https://www.sdcard.org/consumers/faq/
I believe the statement "along with normal usage" indicates that it's based from a scenario when the flash drive is constantly being used to delete & copy files.
For cold storage purposes, the flash drive wont even be used so it wont "write" any more data so it should last longer than that.
For example, I have a dormant USB2.0 thumb drive from 9 years ago and the contents are still intact time I tried, guess it will be broken by the next year :D

Of course having multiple backup in different portable drives as a failsafe is recommended.


Title: Re: Curious Question
Post by: HCP on November 18, 2021, 06:22:19 AM
For example, I have a dormant USB2.0 thumb drive from 9 years ago and the contents are still intact time I tried, guess it will be broken by the next year :D
I would have thought that having it unpowered for extended periods of time might be tempting "bit rot" in a flash memory based device. This article, although it is specifically talking about SSDs, suggests exactly that: https://www.techadvisor.com/how-to/storage/bit-rot-slow-death-of-hard-drives-ssds-3796137/

Although your message implies you may have plugged it in occasionally? ???


Title: Re: Curious Question
Post by: nc50lc on November 18, 2021, 06:54:07 AM
-snip-
Although your message implies you may have plugged it in occasionally? ???
Yes but not-quite-occasionally,
I've been plugging it once or twice a year to check the contents for possible corruption.


Title: Re: Curious Question
Post by: HCP on November 19, 2021, 11:36:41 PM
I've been plugging it once or twice a year to check the contents for possible corruption.
That would probably be more than enough then... as most of the articles I've read (granted none were written within the last 2 years) would indicate that once or twice a year should be enough to keep the "bit rot" at bay ;)

I have one or two SD cards that I'm fairly sure hadn't been plugged into anything or powered up in any way for a couple of years (sitting in storage) and they were "OK"... not sure I'd do the same for crypto backup storage tho ;) :D