spesmilo / electrum

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

Address multisig details show wrong public key #7555

Open 8thgencore opened 2 years ago

8thgencore commented 2 years ago

I have a 3n3 multisig wallet generated a long time ago. When I select wallet -> Details, I copy the public keys.

image

I open bitcoin-core and enter the command bitcoin-cli createmultisig 3 '["pubkey_key_1","pubkey_key_2","pubkey_key_3"]' "p2sh-segway" I get my address.

At the same time, I cannot make a transaction via Electrium, because the address has incorrect wif keys.

If I want to display the public keys of this address from wif, then they are different from the public keys in Electrium.

The seed phrase when creating the wallet was custom, maybe it somehow affected?

SomberNight commented 2 years ago

Electrum sorts the pubkeys when creating the address. Bitcoin Core createmultisig might not do that. Try sorting the pubkeys (lexicographically) manually before calling createmultisig.

8thgencore commented 2 years ago

Thanks Now I noticed that I formulated the question incorrectly.

When I look at the public keys of the address in Details, they are correct.

When I want to display public keys from WIF, then they are different from these. I get a different address from these public keys

As I understand it, incorrect WIF keys are displayed to me. Because of this, I can't sign a transaction through the bitcoin-cli

SomberNight commented 2 years ago

When I want to display public keys from WIF, then they are different from these. I get a different address from these public keys

Please detail exactly what you are doing. What commands are you running? How do you "display public keys from WIF"?

8thgencore commented 2 years ago

I export wif keys from each of the signatories

image

from bit import Key, MultiSig

key1 = Key("WIF1")
key2 = Key("WIF2")
key3 = Key("WIF3")

print(f"Public key1: {key1.public_key.hex()}")
print(f"Public key2: {key2.public_key.hex()}")
print(f"Public key3: {key3.public_key.hex()}")

And the public keys do not converge with those displayed in the wallet

I want to note once again that the wallet was created a long time ago, with a custom seed phrase

SomberNight commented 2 years ago

Could you try reproducing the issue with a freshly created wallet (potentially on testnet)? Try to create the new wallet the same way the original was created.

If you manage to reproduce with the new wallet, share seeds/xpubs for it, and I will try to reproduce too. (testnet would be preferred, but if you do it on mainnet, make sure that you don't send coins there so that the secrets/privkeys can be shared)

Btw, what version of Electrum are you using now, and what version did you use when creating the wallet file originally?

SomberNight commented 2 years ago

Btw, make a copy of the wallet file, as a backup.

Also, is the wallet file password-protected?

8thgencore commented 2 years ago

Btw, make a copy of the wallet file, as a backup.

Also, is the wallet file password-protected?

I have written to you by email to transfer the file

8thgencore commented 2 years ago

Could you try reproducing the issue with a freshly created wallet (potentially on testnet)? Try to create the new wallet the same way the original was created.

If you manage to reproduce with the new wallet, share seeds/xpubs for it, and I will try to reproduce too. (testnet would be preferred, but if you do it on mainnet, make sure that you don't send coins there so that the secrets/privkeys can be shared)

Btw, what version of Electrum are you using now, and what version did you use when creating the wallet file originally?

I created this wallet a long time ago. But when I try to simulate this situation now, it doesn't work.

This is a mistake with exactly the wallet that I created a long time ago

SomberNight commented 2 years ago

I have written to you by email to transfer the file

Please don't send me sensitive information such as wallet files or private keys.

what version did you use when creating the wallet file originally?

I created this wallet a long time ago.

"long time ago" is very subjective. Try to make a best effort guess for at least the year (and whether the Electrum version you used at the time was the latest).


Please answer the previous questions:

If the file is not password-protected, make a copy of the wallet file as backup, and then enable password protection, and see if there are any errors when entering the password. Certain types of wallet file corruption are detected when checking the password.


In the Qt desktop app, go to the Console tab (menubar>View>Show Console), and run the following command:

[ks.get_type_text() for ks in wallet.get_keystores()]

Then also run this:

[ks.is_watching_only() for ks in wallet.get_keystores()]

Share the output of the commands here.

8thgencore commented 2 years ago

[ks.get_type_text() for ks in wallet.get_keystores()]

bip32

[ks.is_watching_only() for ks in wallet.get_keystores()]

False

SomberNight commented 2 years ago

In menubar>Wallet>Information, what is Wallet type and Script type?

8thgencore commented 2 years ago

Wallet type: 3of3

Script type: P2wsh-p2sh

SomberNight commented 2 years ago

[ks.get_type_text() for ks in wallet.get_keystores()]

bip32

[ks.is_watching_only() for ks in wallet.get_keystores()]

False

Wallet type: 3of3

These two replies are not consistent... The commands would return a list of items for a multisig wallet.

Also, again:

Please answer the previous questions:

  • what version of Electrum are you using now?
  • is the wallet file password-protected?
8thgencore commented 2 years ago

If i run [ks.get_type_text() for ks in wallet.get_keystores()], return empty string

Because i send wallet.get_keystores()[0].get_type_text()

Now i use 4.1.5

Wallet file is not password-protected

Derivation path is custom