signMessage

import { signMessage } from 'sats-connect'

You can request a message to be signed by the wallet simply by calling the signMessage function from sats-connect.

When signing a message using Xverse there are two types of signatures you should expect:

  • ECDSA signatures over the secp256k1 curve when signing with the BTC payment (p2sh(p2wpkh)) address

  • BIP322 signatures when signing with the Ordinals (p2tr) address

payloadDescription

network

an object specifying the target Bitcoin chain (Mainnet / Testnet)

address

address used to sign the message

message

message to be signed by the wallet

const signMessageOptions = {
  payload: {
    network: {
      type: "Testnet",
    },
    address: 'ordinalsAddress',
    message: "Hello World",
  },
  onFinish: (response) => {
    // signature
    alert(response);
  },
  onCancel: () => alert("Canceled"),
};
await signMessage(signMessageOptions);

Last updated