-
Notifications
You must be signed in to change notification settings - Fork 811
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
RPC signmessage #802
RPC signmessage #802
Conversation
This comment has been minimized.
This comment has been minimized.
Got the tests to pass locally and also signed/verified messages between bcoin and bitcoind:
It is perhaps a little weird that bcoin returns |
@pinheadmz Good catch, fixed it. |
Moving the RPC methods that don't require wallet, chain, network access sounds like a good plan. Regardless, message signing and verification should work. |
Looks like this needs a rebase on master. Would be helpful to have merged for this external package: https://github.com/pinheadmz/bid |
I believe the tests were organized in a prior commit in preparation for this, see #804. |
Should I move to #810 ? I can rebase this as well. |
@nodar-chkuaselidze I vote for rebase, this is ready to merge, its an important bug fix. #810 doesn't really fix anything like this does, that may be have to rebase after this is merged. |
Rebased. |
@braydonf Most of these are legacy, they should not be part of the bcoin or need to be modified to so they are relevant to the codebase. I just reformatted and put TODOs. I can clean them up in this PR though, but that was the reason for those modifications. |
Okay, yeah I think those changes are not needed in this PR (see braydonf@c71a6e2). |
rebased. |
LGTM
|
I was, however, able to sign a message with a bech32 address. I think this is undefined behavior in bitcoind:
|
Okay I have Electrum v3.3.4 installed locally, and was able to sign and verify messages back and forth between Electrum and bcoin with bech32 addresses. So even though Bitcoin Core doesn't sign or verify with bech32 yet, there is at least some community agreement that it is an ok thing to do. Electrum reference: spesmilo/electrum@e299df7 |
We should also track spesmilo/electrum#3861 and add our compatibility with Electrum if this PR gets merged as-is. |
I think there is general confusion around using a bitcoin address to verify signatures, as the address may not correspond with a private and public key pair. So I think the use case is somewhat discouraged because it can be confusing (and likely why bech32 isn't working across implementations). To support it in all cases I think is fairly complex and making the use case less useful. We can fix signing/verifying, however there should probably be some skepticism in regards to new use cases that may use an address for the purpose of verifying and signing messages. |
Builds on top #464, fixes issue #460
General updates on the
signmessagewithprivkey
,verifymessage
andsignmessage
:These two calls are outdated and only work for old
P2PKH
addresses. It cannot be used with witness transactions or p2sh.
BitcoinCore thread about this: Bitcoin Core issue
Trezor implemeneted variation of signmessage, details in the issue.
There's new proposal for generic signed messages signing:
BIP 322: Generic Signed Message Format and BIP 322 - PR.
There's also an discussion about not adding new utility
RPC calls to the RPC that can be implemented as a library.
Other updates:
bufio
bval
and write more tests there.NOTE: Bcrypto@4 changes
signRecoverable
: bcoin-org/bcrypto#22