-
Notifications
You must be signed in to change notification settings - Fork 179
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
Fix signmessage to be Electrum-compatible #841
Conversation
Some reference points: original commit that added signmessage, in Jun 2017, was working at that time: 28912ac#diff-326acdd19b880cb124ebd72bd49b94eb9b14167dfac0e1dad049059ec3c18e94R390-R393 - but note that that was shortly before segwit, so working with legacy addresses. The functionality offered was specifically the ability to create signatures verifiable in Bitcoin Core; no verification method was added then (or since).
The later introduction of python-bitcointx replacing most (but not all unfortunately!) uses of coincurve didn't really change this, at the time, except in a trivial sense: an attempt to call the The fact that we haven't had complaints for years does rather suggest this is not an important feature today! But it could be useful, and as can be seen, the change needed to at least make it Electrum compatible, for now, is close to trivial. A very important detail should be remembered: the Joinmarket communication protocol itself uses message signatures, and they are using the effectively now "legacy" coincurve-based Edit: just dropping a couple of additional related code links in case they're useful: Core signing code |
Tested (meaning: create signatures with Joinmarket address and wallet-tool signmessage, then attempt to verify in Electrum desktop) as working with both p2sh-p2wpkh and p2wpkh addresses. Note that only mainnet is supported (just to minimize the workload, not for a fundamental reason). |
Could we add some test(s) to test suite for this? |
Yep, good call, I'll add a few test cases. |
Test suite passing, flake8 OK (we really need to re-set up CI ..), the signatures are from both wallet types and all verify against Electrum latest version. No real rush, but I'll squash and merge if I get a tACK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 53d41eb (tested against Electrum 4.0.9 with p2wpkh)
OK squashing and merging, thanks. |
Verification of message signatures against segwit addresses is not currently functional/possible in Core, and additionally the signing function used for messages in jmbitcoin, derived from coincurve, was not compatible with Electrum either. This commit uses the functionality in python-bitcointx's signmessage module, and now the wallet method `signmessage` creates signatures on messages against segwit addresses that are verifiable in Electrum. Test cases of p2sh and native are added.
Verification of message signatures against segwit addresses
is not currently functional/possible in Core, and additionally
the signing function used for messages in jmbitcoin, derived
from coincurve, was not compatible with Electrum either.
This commit uses the functionality in python-bitcointx's
signmessage module, and now the wallet method
signmessage
creates signatures on messages against segwit addresses that
are verifiable in Electrum.