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

signmessage and signmessagewithprivkey don't work unless the address you use is of type legacy #976

Open
wintercooled opened this issue Mar 29, 2021 · 1 comment

Comments

@wintercooled
Copy link
Contributor

elements-0.18.1.9

signmessage and signmessagewithprivkey only seem to work with p2pkh which is not the default in elements.

With a default address type this errors on signing:

elements-cli getnewaddress
AzpoUdjKavd8ZL4NTnaWt4bEYfVo4a5J42pDdAzCrzH3F7M5xk5iNSNCR3RfV9XndGEdnFv5uTs1EBmN

elements-cli signmessage AzpoUdjKavd8ZL4NTnaWt4bEYfVo4a5J42pDdAzCrzH3F7M5xk5iNSNCR3RfV9XndGEdnFv5uTs1EBmN "test"

error code: -3
error message:
Address does not refer to key

This will work if you use a legacy address type:

elements-cli getnewaddress "" "legacy"
CTEy43xUzkSCZGFnx2YjdoNpN6v8tVRUeBfyAb4N4K7UbqwNvaxjcxJJ5w3aeUtUbznpasycz1RnZksM

elements-cli signmessage CTEy43xUzkSCZGFnx2YjdoNpN6v8tVRUeBfyAb4N4K7UbqwNvaxjcxJJ5w3aeUtUbznpasycz1RnZksM "test"
IAEC8m8LC8DPUNVdKVnWlV00XqoYLWPWn83iP8ZAQ33ZKNyPnoU5cuDCpZCeKdpjqblgz9hKa9xKPW8Uhzue8Us=

elements-cli verifymessage CTEy43xUzkSCZGFnx2YjdoNpN6v8tVRUeBfyAb4N4K7UbqwNvaxjcxJJ5w3aeUtUbznpasycz1RnZksM IAEC8m8LC8DPUNVdKVnWlV00XqoYLWPWn83iP8ZAQ33ZKNyPnoU5cuDCpZCeKdpjqblgz9hKa9xKPW8Uhzue8Us= "test"
true

signmessagewithprivkey appears to work but verify stage fails:

elements-cli dumpprivkey AzpoUdjKavd8ZL4NTnaWt4bEYfVo4a5J42pDdAzCrzH3F7M5xk5iNSNCR3RfV9XndGEdnFv5uTs1EBmN
cSKSEM2nt24PRNMntCpExVhQbrmk5MffaNgWDS9zxWCt1yJgXvEF

elements-cli signmessagewithprivkey cSKSEM2nt24PRNMntCpExVhQbrmk5MffaNgWDS9zxWCt1yJgXvEF "test"
Hy5mGfJvFmLy6ZWXxxxLwymMvyOBI+vkFpFo8s+oWuFuFQiFN/Rb13L9ZjoUGWjJjGuvGDuhFfHx+Vgsl08xWqY=

elements-cli verifymessage AzpoUdjKavd8ZL4NTnaWt4bEYfVo4a5J42pDdAzCrzH3F7M5xk5iNSNCR3RfV9XndGEdnFv5uTs1EBmN "Hy5mGfJvFmLy6ZWXxxxLwymMvyOBI+vkFpFo8s+oWuFuFQiFN/Rb13L9ZjoUGWjJjGuvGDuhFfHx+Vgsl08xWqY=" "test"
error code: -3
error message:
Address does not refer to key
@apoelstra
Copy link
Member

This is an issue in upstream as well, that signmessage/venifymessage only work with p2pkh. BIP322 is a proposed replacement but the specification isn't complete and it hasn't seen very much adoption or enthusiasm.

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

2 participants