Bitcoin Forum

Bitcoin => Electrum => Topic started by: anykao on September 09, 2020, 06:36:24 AM



Title: [Solvd]Sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: anykao on September 09, 2020, 06:36:24 AM
Got this error message.

Code:
b'\xa8*\x08\xe9\xfb@\x170zz\x08\x88\x13\t\x19\x8a\xceB\x1eP\x95\x05\x00u\xc1\x05\xb3\x08\x08\x8b\x83\x8d'

How could I check the what is going wrong?


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: pooya87 on September 09, 2020, 09:21:49 AM
it looks like the python code printed the raw bytes instead of the human readable string. i tried converting it to a string but i'm not a python expert and i got encoder out of range errors.

this could be for a couple of reasons that involved your transaction being rejected by your client or the node that received it. you could post the testnet transaction here so that we may see what the problem is.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: anykao on September 09, 2020, 01:12:42 PM
Thanks for your reply.

Quote
this could be for a couple of reasons that involved your transaction being rejected by your client or the node that received it. you could post the testnet transaction here so that we may see what the problem is.

Since the sending cannot be signed, there is no transaction.

I also tried other addresses, but failed with different error messages.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: bob123 on September 09, 2020, 01:55:13 PM
Since the sending cannot be signed, there is no transaction.

Just because it is not signed, it still is called a transaction..
The transaction first has to be constructed. Then it is going to be signed.

You should start explaining what exactly you did and what exactly you are trying to accomplish.
This seems to be  a XY problem (https://en.wikipedia.org/wiki/XY_problem).


Without any information, no one is able to help you.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: anykao on September 09, 2020, 03:04:40 PM
I mean the transaction is not broadcasted, since the signing failed.
I got a capture of the transaction and the error message.

https://imgur.com/a/7waSHOa

By the way, I use trezor with electrum, and succeeded in sending coins using trezor web wallet.

Actually I checked write logs to file, but couldn't find the log file.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: Abdussamad on September 09, 2020, 05:27:36 PM
the log files are in the data directory:

https://electrum.readthedocs.io/en/latest/faq.html#datadir

are you using electrum 4.0.2 ? this bug may have been fixed in recent versions.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: HCP on September 09, 2020, 09:27:58 PM
are you using electrum 4.0.2 ? this bug may have been fixed in recent versions.
The buttons on the bottom of the "advanced preview" indicate that that screenshot is not from 4.0.2...


Since the sending cannot be signed, there is no transaction.
I mean the transaction is not broadcasted, since the signing failed.
I got a capture of the transaction and the error message.

https://imgur.com/a/7waSHOa
NOTE: If you click the "copy" button on the window shown in your screenshot from the link above, it will copy the raw transaction hex data to your clipboard and you'll be able to paste that data here... that might assist folks in troubleshooting why your transaction is not working.

Having said that, I would definitely take Abdussamad's advice and update to 4.0.2 first and then try your transaction again.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: NotATether on September 09, 2020, 11:08:19 PM
Exploring the Python functions that implements the sign transaction button on Electrum, and going down through calls leads me to here, in ECPrivkey.sign(msg_hash, sigencode): https://github.com/spesmilo/electrum/blob/9b4414fb2ea87dbb3ce410fc030af0c23c0bcd79/electrum/ecc.py#L444. I found this error message in that function:

Code:
"msg_hash to be signed must be bytes, and 32 bytes exactly"

The error message you posted is 31 bytes. It may not actually be an error message, it looks to me like it is an invalid message hash.

When I decoded this transaction using
Code:
>>> byte_array = bytearray(b'\xa8*\x08\xe9\xfb@\x170zz\x08\x88\x13\t\x19\x8a\xceB\x1eP\x95\x05\x00u\xc1\x05\xb3\x08\x08\x8b\x83')
>>> hexadecimal_string = byte_array.hex()
>>> print(hexadecimal_string)

I got the transaction a82a08e9fb4017307a7a08881309198ace421e5095050075c105b308088b83. It doesn't look to me like this is a valid transaction hash, at least from putting it in Blockcypher.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: anykao on September 10, 2020, 02:21:46 AM
Quote
are you using electrum 4.0.2 ? this bug may have been fixed in recent versions.

Forgot to mention that I am using electrum 3.3.8.
Code:
20200910T001913.665524Z |     INFO | logging | Electrum version: 3.3.8 - https://electrum.org - https://github.com/spesmilo/electrum
I actually succeeded sending by upgrading 4.0.2, but I'm would like to stick to 3.3.8.

In the log file, I just got this error message.

Code:
20200910T034828.887916Z |    ERROR | gui.qt.main_window.[meng_wallet] | on_error
Traceback (most recent call last):
  File "electrum\gui\qt\util.py", line 718, in run
  File "electrum\wallet.py", line 1112, in sign_transaction
  File "C:\Program Files (x86)\Electrum\electrum\plugins\trezor\trezor.py", line 91, in sign_transaction
    self.plugin.sign_transaction(self, tx, prev_tx, xpub_path)
  File "C:\Program Files (x86)\Electrum\electrum\plugins\trezor\trezor.py", line 336, in sign_transaction
    signatures, _ = client.sign_tx(self.get_coin_name(), inputs, outputs, details=details, prev_txes=prev_tx)
  File "C:\Program Files (x86)\Electrum\electrum\plugins\trezor\clientbase.py", line 224, in sign_tx
    return trezorlib.btc.sign_tx(self.client, *args, **kwargs)
  File "site-packages\trezorlib\tools.py", line 233, in wrapped_f
  File "site-packages\trezorlib\btc.py", line 158, in sign_tx
KeyError: b'\x16\xa4n[\x10\xb1\xc8\x84\xe2\xe9\\\x88!\xa6\x11p~9/\x95\x16.-p\x85\xf1f>}\x80z4'

And the raw transaction is

Code:
45505446ff0002000000000101347a807d3e66f185702d2e16952f397e7011a621885ce9e284c8b1105b6ea41601000000171600143fa041c1cc9a4e15e8f1ce48f6a984c9a053403ffdffffff02a0860100000000001600147db29ebf97d94c484ee65d92f7b69fd808fd62f7fbba0d000000000017a9144e2be4952ea47f45e6e57ad3f527ee40b34a98d587feffffffff40420f000000000000000201ff53ff044a5262034a756f47800000006f2a80d928ace8c63f924145ec0c47bd82c085456e714dd7c6cc2a988c2b09310318415245f4db17ee7e313d9ab4c94cd7451f017a72a0f2e000c298b3d2c773b0000000000bf71b00


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: nc50lc on September 10, 2020, 03:47:37 AM
I actually succeeded sending by upgrading 4.0.2, but I'm would like to stick to 3.3.8.
Too bad, you won't be able to use that wallet file to 3.3.8 unless you have a backup or create another copy (which is easy).

It seems like it was an issue of compatibly with a certain Trezor firmware version:
https://github.com/spesmilo/electrum/issues/6214 (https://github.com/spesmilo/electrum/issues/6214) Read the replies to the issue for more info.


Title: Re: sent testnet coin from p2sh-segwit address to native-segwit address error
Post by: anykao on September 10, 2020, 03:55:36 AM
Quote
It seems like it was an issue of compatibly with a certain Trezor firmware version:
https://github.com/spesmilo/electrum/issues/6214 Read the replies to the issue for more info.

Exactly.

Thank you very much. You saved my day.