Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: lmazur on March 30, 2018, 09:52:04 PM



Title: signmessage doesn not work - Address does not refer to key
Post by: lmazur on March 30, 2018, 09:52:04 PM
Hello, I am new here.

I am experimenting with a full node, and setup a new node on ubuntu - Core 0.16.0.
I'm running my bitcoind in test-net

I am having an issue running signmessage [key] [message].  Whenever I try to sign a message with my pub key, it shows this error

Steps:

1. bitcoin-cli getnewaddress
--> It produced an address: 2N2yv1XcYfNXR54J7ZJvBxY6ZnmZFbz89tm

2. bitcoin-cli signmessage "2N2yv1XcYfNXR54J7ZJvBxY6ZnmZFbz89tm" "Hello there"

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


This is pretty vanilla functionality - why is this happening and how to address?

Thank you in advance.




Title: Re: signmessage doesn not work - Address does not refer to key
Post by: LoyceV on March 30, 2018, 10:16:03 PM
--> It produced an address: 2N2yv1XcYfNXR54J7ZJvBxY6ZnmZFbz89tm
Isn't this a testnet SegWit address? You can't sign message from those.

Disclaimer: I've never used Bitcoin Core on the command line, and I've barely used testnet addresses.


Title: Re: signmessage doesn not work - Address does not refer to key
Post by: bob123 on March 30, 2018, 10:24:37 PM
Addresses starting with 2.. are P2SH on tesnet.
So either 1) multisignature or 2) nested segwit.

Since getnewaddress returned this address i assume you use nested segwit and not multisig.
Unfortunately, as LoyceV already mentioned, you can't sign message from those yet.

Thats not because it is not technically achievable, it is due to the missing convention on how to exactly perform this.
This is on the 'to-do list'.


Title: Re: signmessage doesn not work - Address does not refer to key
Post by: starmyc on March 31, 2018, 07:34:28 AM
This is pretty vanilla functionality - why is this happening and how to address?

Use "legacy" addresses, as stated in other posts:

Code:
 $ bitcoin-cli -testnet getnewaddress "" legacy
mjqWH4b7pjGgLhzMeTxknEH1uiRqvHPrzh

$ bitcoin-cli -testnet signmessage mjqWH4b7pjGgLhzMeTxknEH1uiRqvHPrzh "blablabla"
IPwZKrocIgT2AdUKp3CCSjLUotUuYKNCPUGIaX6tmkspbe/HHq1TAwAJ/ltVZzA3nhfX7gU9KM0XFcO+n2eaCAo=


Title: Re: signmessage doesn not work - Address does not refer to key
Post by: tumikosha on April 07, 2018, 12:56:08 PM
I have this problem too. I am trying to proof the ownership of my address via signing the message. Steps to reproduce:
1) I download Bitcoin Core 0.16.0
2) Have started bitcoin-qt.exe
3) Generate new adress: 32iCzcXZefA9j84Q2A7EXPUwRwA6bykQij
4) When i tried to sign message with this adress
it shows an Error:
The entered address does not refer to a key. Please check the address and try again.
How i can sign message and proof my ownership of my address?
What I am doing wrong?


Title: Re: signmessage doesn not work - Address does not refer to key
Post by: ranochigo on April 07, 2018, 01:11:36 PM
I have this problem too. I am trying to proof the ownership of my address via signing the message. Steps to reproduce:
1) I download Bitcoin Core 0.16.0
2) Have started bitcoin-qt.exe
3) Generate new adress: 32iCzcXZefA9j84Q2A7EXPUwRwA6bykQij
4) When i tried to sign message with this adress
it shows an Error:
The entered address does not refer to a key. Please check the address and try again.
How i can sign message and proof my ownership of my address?
What I am doing wrong?
Nothing.

Signing message uses a signature and an address to validate. When the message is signed, a private key is used and the public key can be derived from its signature. With P2SH addresses, there isn't a public key for the client to use and it's just a script. You can't sign with P2SH/P2SH-P2WPKH as of now.


Title: Re: signmessage doesn not work - Address does not refer to key
Post by: bob123 on April 07, 2018, 01:46:42 PM
it shows an Error:
The entered address does not refer to a key. Please check the address and try again.
How i can sign message and proof my ownership of my address?
What I am doing wrong?

Wow. You didn't even read the first reply in this thread?
It is stated, that it is currently not possible to sign messages from P2SH addresses (starting with 3..).

If you are interested in the reason why its currently not possible, you can read the replys to this post: https://github.com/bitcoin/bitcoin/issues/10542 (https://github.com/bitcoin/bitcoin/issues/10542)