Skip to content
ecdsa.com
Bitcoin Core RPCWeb3 wallets and signatures

Error message

Address does not refer to key

Also printed as

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

`bitcoin-cli` prints "error code: -3" and "error message:" on the lines before the text. JSON-RPC clients see `{"code": -3, "message": "Address does not refer to key"}`.

Bitcoin Core RPC — verifymessage / signmessage with a non-P2PKH address

What it means

Bitcoin Core's message signing (`signmessage`/`verifymessage`) implements the original "Bitcoin Signed Message" scheme, which only works for legacy P2PKH addresses: the signature recovers a public key, and Core compares its hash with the address. Native SegWit (`bc1q…`), Taproot (`bc1p…`) and P2SH (`3…`) addresses are not "key" addresses in that sense, so Core rejects them with RPC error -3 instead of returning true or false.

Why it happens

How to fix it

  1. 1.

    Sign with a legacy address in Core

    If the counterparty only needs proof of control over a key in your wallet, create a legacy address for the proof.

    bash
    # Bitcoin Core signs and verifies messages only for legacy P2PKH addresses (1... / m... / n...)
    addr=$(bitcoin-cli getnewaddress "proof" legacy)
    sig=$(bitcoin-cli signmessage "$addr" "I own this address")
    bitcoin-cli verifymessage "$addr" "$sig" "I own this address"
  2. 2.

    Use BIP-322 for SegWit and Taproot

    BIP-322 defines message signatures for every address type. Use a library or wallet that implements it, and agree on it with the verifier.

    js
    // SegWit / Taproot addresses: BIP-322 "simple" signatures, e.g. with the bip322-js library
    import { Verifier } from "bip322-js";
    
    const ok = Verifier.verifySignature("bc1q...", "I own this address", signatureBase64);

Related errors

Browse the full signature error database