Bitcoin public key operations: derivation, compression, address generation, verification.
Summary
Functions
Compress a public key to 33 bytes.
Decompress a public key to 65 bytes.
Derive a child public key using BRC-42 key derivation.
Compute ECDH shared secret (delegates to private key).
Create a public key from raw bytes (33 compressed or 65 uncompressed).
Derive a compressed public key from a private key.
Generate a Bitcoin address from this public key.
Verify a signature against a message hash.
Types
@type t() :: %BSV.PublicKey{point: binary()}
Functions
Compress a public key to 33 bytes.
Decompress a public key to 65 bytes.
@spec derive_child(t(), BSV.PrivateKey.t(), String.t()) :: {:ok, t()} | {:error, String.t()}
Derive a child public key using BRC-42 key derivation.
Computes ECDH shared secret with the private key, then HMAC-SHA256(shared_secret_compressed, invoice_number) to derive a scalar, multiplies G by that scalar, and adds the result to this public key point.
Create a public key from raw bytes (33 compressed or 65 uncompressed).
Validates that the point lies on the secp256k1 curve (y² ≡ x³ + 7 mod p).
@spec from_private_key(BSV.PrivateKey.t()) :: t()
Derive a compressed public key from a private key.
Generate a Bitcoin address from this public key.
Verify a signature against a message hash.