trezor / python-trezor

:snake: Don't use this repo, use the new monorepo instead:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
201 stars 194 forks source link

error:a bytes-like object is required, not 'str #292

Closed TuoUP closed 6 years ago

TuoUP commented 6 years ago

"Error: a byte-like object is required, not 'str'", this error occurs when signing Script (OP_RETURN) with Trezor (firmware 1.6.0), IN Addition,I try it by Electrum,and I type a script, NOT A ADDRESS, as outputs.what should I do to solve this problem?

matejcik commented 6 years ago

I don't think what you are doing is supported. You must input an address, not a script.

Can you post example command that triggers this error?

TuoUP commented 6 years ago

I use https://www.blockchain.com/btc/tx/728e24b2e7dd137e574c433a8db08ac2aa0bf0588ad7716e4c5a7da45dbb5933?show_adv=true,this link inside Output Scripts 40434f5059524f424f4037333839643664313135313465633035636335663135656236353932383630383430343733346230343932636132656364396564343837326230343265666137 as output, I just want to verify that the output can be succeed signature and broadcasted, and do not care whether parsed or unparsed , but now it is impossible to enter the signature.

webwxgetmsgimg 2

IN ADDITION, when I view source code, I notice that Trezorlib has different type, such as PAYTOADDRESS, PAYTOSCRIPTHASH, PAYTOMULTISIG, PAYTOOPRETURN, PAYTOWITNESS, PAYTOP2SHWITNESS, and when I view Electrum(version 3.2.2) source code, I notice that code convert TYPE_SCRIPT(one of output type) into PAYTOOPRETURN,the same Script I typed, without Trezor ,I just use Electrum ,this Script can be signed and broadcast. So, I am confused why Trezor cannot sign my Script successfully.

matejcik commented 6 years ago

this is a Electrum bug https://github.com/spesmilo/electrum/issues/4591