Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message signing with bech32 addresses crashes Electrum #2977

Closed
SomberNight opened this issue Oct 4, 2017 · 3 comments
Closed

Message signing with bech32 addresses crashes Electrum #2977

SomberNight opened this issue Oct 4, 2017 · 3 comments

Comments

@SomberNight
Copy link
Member

Signing messages with p2wpkh and p2wpkh-p2sh addresses is not standardized (yet?), see e.g. bitcoin/bitcoin#10542
I think for the time being it can be disabled altogether, which is also what the current code (91ed74a) aims to do:

electrum/gui/qt/main_window.py

Lines 1901 to 1903 in 91ed74a

if not bitcoin.is_p2pkh(address):
self.show_message('Cannot sign messages with this type of address.' + '\n\n' + self.msg_sign)
return

Though perhaps this remark needs updated?

electrum/gui/qt/main_window.py

Lines 1890 to 1892 in 91ed74a

"private key, and verifying with the corresponding public key. The "
"address you have entered does not have a unique public key, so these "
"operations cannot be performed.")

However, on current master, trying to sign a message with a bech32 address results in a crash:

Traceback (most recent call last):
  File "/home/user/wspace/electrum/gui/qt/main_window.py", line 1957, in <lambda>
    b.clicked.connect(lambda: self.do_sign(address_e, message_e, signature_e))
  File "/home/user/wspace/electrum/gui/qt/main_window.py", line 1281, in request_password
    return func(self, *args, **kwargs)
  File "/home/user/wspace/electrum/gui/qt/main_window.py", line 1901, in do_sign
    if not bitcoin.is_p2pkh(address):
  File "/home/user/wspace/electrum/lib/bitcoin.py", line 562, in is_p2pkh
    addrtype, h = b58_address_to_hash160(addr)
  File "/home/user/wspace/electrum/lib/bitcoin.py", line 314, in b58_address_to_hash160
    return _bytes[0], _bytes[1:21]
TypeError: 'NoneType' object is not subscriptable
Aborted
@lzsaver
Copy link
Contributor

lzsaver commented Oct 4, 2017

The same thing if I try to send coins to the bech32 address (#2976).

@ecdsa
Copy link
Member

ecdsa commented Oct 5, 2017

added in e299df7

@ecdsa ecdsa closed this as completed Oct 5, 2017
@prusnak
Copy link
Contributor

prusnak commented Dec 8, 2017

@ecdsa you should have used the scheme proposed in bitcoin/bitcoin#10542 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants