Verify message signature
Signature verification depends on the type of address the message was signed with
Ordinals Address P2TR
P2TR
Message signing for P2TR addresses conform to the BIP-322 standard. The following options are available to verify the message signature.
Calling the
verifymessage
RPC command on a Bitcoin node built from the source of the unreleased BIP-322 feature branch. Reference: https://developer.bitcoin.org/reference/rpc/verifymessage.html https://github.com/bitcoin/bitcoin/pull/24058Use the NPM package BIP322-js https://www.npmjs.com/package/bip322-js
Payment Address P2SH(P2WPKH)
P2SH(P2WPKH)
Messages from the payment address are signed with an ECDSA signature, conforming to the standard described here: https://en.bitcoin.it/wiki/Message_signing
You can decode the signed message and use a cryptographic library to verify the signature.
Using bitcoinjs-message
can also be a convenient option if you're working within a JavaScript or Node.js environment. It abstracts away the lower-level details of ECDSA verification and the Bitcoin message signing standard, allowing you to verify signed messages with minimal code:
Step 1: Install bitcoinjs-message
First, you need to install the bitcoinjs-message
library. If you're using npm, you can install it by running:
Step 2: Verify the Message
Once installed, you can use the library to verify a message with just a few lines of code. Here's a simple example:
Last updated