Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: metallicelmo on December 24, 2020, 11:48:01 AM



Title: Bitcoin Core 0.20.1 Address does not refer to key when signing message
Post by: metallicelmo on December 24, 2020, 11:48:01 AM
So guys, I've been using Bitcoin Core 0.20.1 and now I had to sign a message to be able to verify an address when buying some BTC.. part of a KYC process.

I have two type of addresses in my wallet. One starting with "3"  and one with "bc1"

I expected the first one not to work since its a sort of legacy address.

When signing with either of them I get the following error "Address does not refer to key (code -3)"

So now it seems that no matter what type of address I create from within that same wallet, none of them are able to sign messages...

Am I missing something or does this function simply not work? It seems Electrum can do it just fine.


Title: Re: Bitcoin Core 0.20.1 Address does not refer to key when signing message
Post by: Rath_ on December 24, 2020, 11:58:59 AM
I expected the first one not to work since its a sort of legacy address.

Both are SegWit addresses. A legacy address starts with 1.

Am I missing something or does this function simply not work? It seems Electrum can do it just fine.

This function does not work. A standard of signing messages is currently being worked on (https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki). Only Electrum is able to verify its messages signed using SegWit addresses. Either import your private key for that address into Electrum and inform the other party that they will be able to verify your message only using Electrum or use a legacy address instead.


Title: Re: Bitcoin Core 0.20.1 Address does not refer to key when signing message
Post by: hosseinimr93 on December 24, 2020, 01:03:32 PM
For signing a message in Bitcoin core, you need a legacy address.
And for generating a legacy address in bitcoin core, go to console and use the command below.

Code:
getnewaddress "" legacy

For generating a legacy address that have a label, you can use the command below.

Code:
getnewaddress ("Enter the label here" "legacy")


Title: Re: Bitcoin Core 0.20.1 Address does not refer to key when signing message
Post by: metallicelmo on December 24, 2020, 01:49:24 PM
I expected the first one not to work since its a sort of legacy address.

Both are SegWit addresses. A legacy address starts with 1.

Am I missing something or does this function simply not work? It seems Electrum can do it just fine.

This function does not work. A standard of signing messages is currently being worked on (https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki). Only Electrum is able to verify its messages signed using SegWit addresses. Either import your private key for that address into Electrum and inform the other party that they will be able to verify your message only using Electrum or use a legacy address instead.
Thanks for the info! I'll do it using Electrum then.


Title: Re: Bitcoin Core 0.20.1 Address does not refer to key when signing message
Post by: metallicelmo on December 24, 2020, 01:49:57 PM
For signing a message in Bitcoin core, you need a legacy address.
And for generating a legacy address in bitcoin core, go to console and use the command below.

Code:
getnewaddress "" legacy

For generating a legacy address that have a label, you can use the command below.

Code:
getnewaddress ("Enter the label here" "legacy")
Thanks for this info, I'll try and see if that does the trick for now.