Error message
Malformed base64 encoding
Also printed as
- error code: -3 error message: Malformed base64 encoding
`bitcoin-cli` prints "error code: -3" and "error message:" before the text. A well-formed base64 string that is not a valid signature returns `false` instead of an error.
Bitcoin Core RPC — verifymessage with a signature that is not base64
What it means
`verifymessage` expects the 65-byte compact signature encoded in standard base64 (88 characters, usually starting with `H`, `I`, `G` or `J`). The string you passed is not valid base64, so Core did not even try to recover a key and returned RPC error -3. The signature may be correct — it is in the wrong text encoding.
Why it happens
Hex instead of base64
commonApplications and hardware-wallet SDKs often return signatures as hex (130 characters). Core rejects them.
Damaged in a URL or form
occasional`+` turned into a space by form decoding, `%2B`/`%3D` left encoded, or base64url (`-`, `_`) produced by a web library.
An Ethereum signature
occasionalA `0x…` signature from `personal_sign` is a different scheme (EIP-191 prefix, other v convention) and not base64.
How to fix it
- 1.
Convert hex signatures to base64
Decode the hex to 65 bytes and encode them in standard base64 without line breaks.
bash sig_b64=$(printf '%s' "$SIG_HEX" | xxd -r -p | base64 -w0) # 65 bytes -> 88 base64 characters bitcoin-cli verifymessage "$ADDRESS" "$sig_b64" "$MESSAGE" - 2.
Undo URL and base64url encoding
Decode percent-encoding first, then convert base64url to standard base64 with padding.
python import base64, urllib.parse sig = urllib.parse.unquote(sig_from_query) # undo %2B / %2F / %3D sig = base64.b64encode(base64.urlsafe_b64decode(sig + "=" * (-len(sig) % 4))).decode() # base64url -> base64