Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

verify_ecdsa_signature

Verify a Bitcoin ECDSA signature

This function works with the new ByteArray-based BitcoinPublicKey structure that properly represents Bitcoin’s 33-byte compressed or 65-byte uncompressed format.

Arguments

  • message_hash - The hash of the message that was signed
  • signature - The ECDSA signature (r, s components and y_parity for recovery)
  • public_key - The BitcoinPublicKey to verify against

Returns

  • bool - True if signature is valid, false otherwise

Fully qualified path: alexandria_btc::legacy_signature::verify_ecdsa_signature

pub fn verify_ecdsa_signature(
    message_hash: u256, signature: Signature, public_key: BitcoinPublicKey,
) -> bool