Skip to main content

btcSignMessage

Bitcoin: sign message

Asks device to sign a message using the private key derived by given BIP32 path.

const result = await HardwareSDK.btcSignMessage(connectId, deviceId, params);

Params

Optional common params

  • path - required string | Array<number> minimum length is 3. read more
  • messageHex - required string message from hex
  • coin - optional string Determines network definition specified in coins.json file. Coin shortcut, name or label can be used. If coin is not set API will try to get network definition from path.
  • noScriptType- optional boolean For signatures without script types.

Example

// Original message
const message = "Hello Bitcoin";

// Convert to hex
const messageHex = Buffer.from(message).toString("hex");

HardwareSDK.btcSignMessage(connectId, deviceId, {
path: "m/44'/0'/1'",
messageHex: messageHex,
});

Result

{
success: true,
payload: {
address: string, // returned signing address
signature: string, // Base64-encoded signature result
}
}

Error

{
success: false,
payload: {
error: string, // error message
code: number // error code
}
}