spesmilo / electrum

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

electrum 4.4.0-4.4.2 not working with legacy ledger bitcoin app (pre-2.1): `no sig for <compressed_pubkey>` #8365

Closed howTOdoIT2 closed 1 year ago

howTOdoIT2 commented 1 year ago

Starting from electrum version 4.4.0 ledger won't work but is working fine with version 4.3.4 There is no info to sign the transaction.

SomberNight commented 1 year ago

What do you mean by not working? Do you get any specific error message? Please enable debug logging and attach a debug log. See https://electrum.readthedocs.io/en/latest/faq.html#how-to-enable-debug-logging What do you mean by "ledger nano"? Original nano? "Nano S"? Nano S plus? Nano X? What is the version of the bitcoin app on your device?

howTOdoIT2 commented 1 year ago

What do you mean by not working? Do you get any specific error message? Please enable debug logging and attach a debug log. See https://electrum.readthedocs.io/en/latest/faq.html#how-to-enable-debug-logging What do you mean by "ledger nano"? Original nano? "Nano S"? Nano S plus? Nano X? What is the version of the bitcoin app on your device?

check this tweet https://twitter.com/Edward2100/status/1651547697260666881 is the same for me

tested by me with Ledger nano and ledger nano S, electrum v4.4.0 v4.4.1, with v4.3.4 is working I can sign the transaction

I will not add any logs from my electrum wallet, sorry but privacy matter for us.. I know I know si safe. maybe not but in the future who knows?


EDIT(sombernight): the tweet contains an image with an error popup, saying:

no sig for 02705cfc...

(i.e. no sig for <compressed_pubkey>)

SomberNight commented 1 year ago

I was not able to reproduce. Without a trace or more info, it's hard to tell, but perhaps this is related to https://github.com/spesmilo/electrum/commit/499f51535ffa54607fd75eb4bf817cb96bd0e0cd. That fix will be released in 4.4.2. Please reopen if it's still not fixed at that point.

howTOdoIT2 commented 1 year ago

is still not working, Do you have a ledger nano S , windows 10 and electrum wallet v4.4.1 ? its only work on version electrum4.3.4

SomberNight commented 1 year ago

Have you tried with 4.4.2 though?

Do you have a ledger nano S , windows 10 and electrum wallet v4.4.1 ?

Yes, I have tested with exactly that scenario and it works for me. There are other variables and you still haven't answered all my questions from before, for example:

What is the version of the bitcoin app on your device?

If it still does not work on 4.4.2, please provide an exception traceback from the debug logs. You can manually remove anything you deem sensitive from the traceback (I guess part of the filesystem path potentially).

is still not working,

Please try to understand that this statement is completely unusable and has approximately zero information value.

SomberNight commented 1 year ago

There was another report on bitcointalk now and it specifically said "Ledger Nano S with bitcoin app version 1.6.0". Using a ledger nano S with bitcoin app version 1.6.3, I can reproduce.

The issue occurs on any modern ledger device when using an old bitcoin app (pre-2.1, I believe). <-- having to use an old bitcoin app was the piece of the puzzle missing before.

Below traceback and modified log for a p2wpkh wallet, but the issue affects all script types. It is a regression from 4.4.0 (from https://github.com/spesmilo/electrum/pull/8230).

 33.36 | W | transaction | heyheyhey. cp1. include_sigs=True force_legacy=False use_segwit_ser=True
 33.36 | W | transaction | heyheyhey. cp2. branch1
 33.37 | E | plugins.ledger.ledger | 
Traceback (most recent call last):
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 669, in sign_transaction
    rawTx = tx.serialize_to_network()
  File "...\electrum\electrum\transaction.py", line 945, in serialize_to_network
    witness = ''.join(self.serialize_witness(x, estimate_size=estimate_size) for x in inputs)
  File "...\electrum\electrum\transaction.py", line 945, in <genexpr>
    witness = ''.join(self.serialize_witness(x, estimate_size=estimate_size) for x in inputs)
  File "...\electrum\electrum\transaction.py", line 839, in serialize_witness
    sol = desc.satisfy(allow_dummy=estimate_size, sigdata=txin.part_sigs)
  File "...\electrum\electrum\descriptor.py", line 378, in satisfy
    sol = self._satisfy_inner(sigdata=sigdata, allow_dummy=allow_dummy)
  File "...\electrum\electrum\descriptor.py", line 574, in _satisfy_inner
    raise MissingSolutionPiece(f"no sig for {pubkey.hex()}")
electrum.descriptor.MissingSolutionPiece: no sig for 033e92e55923ea25809790f292ee9bd410355ee02492472d9a1ff1b364874d0679
 33.38 | I | plugins.ledger.ledger | no sig for 033e92e55923ea25809790f292ee9bd410355ee02492472d9a1ff1b364874d0679

Here is how that unsigned tx hex looks in 4.3.4:

 17.60 | W | transaction | heyheyhey. cp1. include_sigs=True force_legacy=False use_segwit_ser=True
 17.60 | W | transaction | heyheyhey. cp2. branch1
 17.60 | W | transaction | serialize_witness. cp1. entered
 17.60 | W | transaction | serialize_witness. cp2. pubkeys=['022d4280feb2ecf993fff6162d708a876eeac137007dbf58a8ddb04495c8e7aea4'] sig_list=['']
 17.60 | W | transaction | serialize_witness. cp3. wit='020021022d4280feb2ecf993fff6162d708a876eeac137007dbf58a8ddb04495c8e7aea4'
 17.60 | W | transaction | serialize_witness. cp1. entered
 17.61 | W | transaction | serialize_witness. cp2. pubkeys=['0304234dbfc8b78e6fdb313f4530168bb7a6ffe0d83cb235323ec6ee2b7ee5b3a3'] sig_list=['']
 17.61 | W | transaction | serialize_witness. cp3. wit='0200210304234dbfc8b78e6fdb313f4530168bb7a6ffe0d83cb235323ec6ee2b7ee5b3a3'
 17.61 | W | transaction | heyheyhey. cp2.1. witness='020021022d4280feb2ecf993fff6162d708a876eeac137007dbf58a8ddb04495c8e7aea40200210304234dbfc8b78e6fdb313f4530168bb7a6ffe0d83cb235323ec6ee2b7ee5b3a3'
 17.61 | W | plugins.ledger.ledger | heyheyhey. ledger plugin. rawTx='020000000001028d584d655d2892209a1e97ea847db58c615ed40d494dec6bf2f997d8476a23641300000000fdffffff8d584d655d2892209a1e97ea847db58c615ed40d494dec6bf2f997d8476a23642000000000fdffffff0274850100000000001600142cc701ab46749e55833ccb8062171266a2a1c051a0860100000000001600144ab5f845e069c83a817070f768ea4c5241a299fa020021022d4280feb2ecf993fff6162d708a876eeac137007dbf58a8ddb04495c8e7aea40200210304234dbfc8b78e6fdb313f4530168bb7a6ffe0d83cb235323ec6ee2b7ee5b3a3d21c2500'

Apparently we had been giving garbage in past versions in the witness (and scriptSig) to the device, and that worked ok. New electrum however cannot serialize an unsigned tx with such garbage anymore.

Based on my testing, with wallets using script types pkh(), sh(wpkh(), wpkh(), and all three similar (2of2) multisigs, we can give the device a tx serialized with empty scriptSig and empty witness.

sandman21vs commented 1 year ago

I just found out that this same problem is happening with the diy version of jade blocstream, can you tell me which version of electrum can work

SomberNight commented 1 year ago

@sandman21vs see https://github.com/spesmilo/electrum/issues/8463