Skip to content
New issue

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

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

Already on GitHub? # to your account

Sparrow and Electrum produce different signatures #39

Closed
louneskmt opened this issue Nov 23, 2020 · 5 comments
Closed

Sparrow and Electrum produce different signatures #39

louneskmt opened this issue Nov 23, 2020 · 5 comments
Labels
bug Something isn't working medium Medium priority

Comments

@louneskmt
Copy link

louneskmt commented Nov 23, 2020

Hi!

I recently tried to sign a message from Sparrow, to prove my ownership of an address, but the signature got rejected on the website. So I tried with Electrum: I exported the wallet, opened it in Electrum, and signed the same message with the same address, and it resulted to a different signature, which has been accepted by the website.

For example, let's sign the message containing just the word Test with this address 36TcRXxXDgwv5J78EL8QnTTyh5owFAXpb9:

  • Electrum sig:
ID22tR17Iv4JDZOPTDznywOrmP6YsJEhEvlQhvYjqdO4VCiFJOGXiTpZcxzzdOgb4U4/5BsCbnHg/E1xDddgKLY=
  • Sparrow sig:
I21pjaclbCUb+agjKkFTJSHdKYPACzDjsrHdimpuXIEBSDb1kicauaWHZzo+he397Isug//jNNUdF22wf2QQQeY=

They are different, and each one is considered as invalided when verified in the software that did not produced it.

@craigraw
Copy link
Collaborator

First off, that's strange - I am able to verify the Electrum sig using Sparrow. Can you try again?

The longer answer is that, unfortunately, there is no universal standard for message signing for non-P2PKH (addresses that start with 3 or bc1), and in fact Core does not support signing messages with these addresses. Electrum and Trezor followed different paths that unfortunately create different signatures. You can read more about it here: bitcoinjs/bitcoinjs-message#29

Sparrow tries to be standards compliant, and so follows the Trezor path (which is at least documented in a BIP: https://github.com/bitcoin/bips/blob/master/bip-0137.mediawiki) in terms of generating signatures. Sparrow will however validate signatures using the Electrum format as well.

@louneskmt
Copy link
Author

First off, that's strange - I am able to verify the Electrum sig using Sparrow. Can you try again?

Just tried again: it appears that Sparrow can verify Electrum sig while Electrum can't for Sparrow sig.

Thanks for the multiple details and links. Indeed, I tried a few online tools to verify Bitcoin signatures, and none of them give the same result (one accepts both sig, while another accepts only one out of 2, and others neither of them).

Also, I'd suggest to display the hash of the message to be signed in Sparrow, as HW like Ledger display it on its screen, to allow the user to verify it directly on the device. We actually don't know if we sign the good message and not another one, as we cannot compare hashes.

Thanks a lot again.

@6102bitcoin 6102bitcoin added the bug Something isn't working label May 20, 2021
@6102bitcoin
Copy link
Collaborator

Outstanding Action: Add note that electrum can't verify sparrow sigs?
Proposed Priority: Medium (Could cause confusion / frustration)

@6102bitcoin 6102bitcoin added the medium Medium priority label May 23, 2021
@craigraw
Copy link
Collaborator

As of dbfed31 Sparrow now allows toggling between the Electrum and BIP137 signature formats:

Screenshot 2021-06-22 at 15 59 19

Signatures from messages signed with non-P2PKH addresses can now be verified in Electrum. Closing this off as resolved.

@louneskmt
Copy link
Author

Awesome work, thanks @craigraw!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working medium Medium priority
Projects
None yet
Development

No branches or pull requests

3 participants