April 19, 2025

How to sign a message using a Bitcoin private key

How to sign a message with a Bitcoin Private Key

Signing a Message to Prove Ownership of a Bitcoin Address

Reasons to Sign a Message

  • To prove that the address is valid for receiving funds.
  • To show proof of funds (confirming that the balance attached to the address is spendable by you).

Bitcoin full nodes and most self custody wallets with key control have this functionality built in.


Steps to Sign a Message

1. Retrieve the Private Key

To sign a message, first, obtain the private key corresponding to the address. Use the following command:

bitcoin-cli dumpprivkey "address"

Replace "address" with the public address you wish to sign for.
The output will be the private key corresponding to that address.

2. Sign the Message

Use the private key to sign a message. This message can be anything, for example, "Harry's Pet Store" or "Public Bank Address". Use the command:

bitcoin-cli signmessagewithprivkey "privkey" "my message"

Replace "privkey" with the private key retrieved earlier.
Replace "my message" with the message you want to sign.

The output will be a long string of characters — this is the signature.

3. Verify the Signature

Share the message and signature along with the public address to allow others to verify ownership. Verification can be done using:

bitcoin-cli verifymessage "address" "signature" "message"
  • "address": The public address.
  • "signature": The signature generated in the previous step.
  • "message": The message you signed.

If everything checks out, the result will be:

true