An encapsulated public key.

Synopsis

Declared in <pubkey.h>

class CPubKey;

Member Functions

Name

Description

CPubKey [constructor]

Constructors

Decompress

Turn this public key into an uncompressed public key.

Derive

Derive BIP32 child pubkey.

GetHash

Get the 256‐bit hash of this public key.

GetID

Get the KeyID of this public key (hash of its serialization)

IsCompressed

Check whether this is a compressed public key.

IsFullyValid

fully validate whether this is a valid public key (more expensive than IsValid())

IsValid

Check syntactic correctness.

IsValidNonHybrid

Check if a public key is a syntactically valid compressed or uncompressed key.

RecoverCompact

Recover a public key from a compact signature.

Serialize

Implement serialization, as if this was a byte vector.

Set

Initialize a public key using begin/end iterators to byte data.

Unserialize

Deserialize the public key from a stream, as if it were a byte vector.

Verify

Verify a DER signature (~72 bytes). If this public key is not fully valid, the return value will be false.

begin

Iterator to the first byte of the serialized public key.

data

Pointer to the first byte of the serialized public key.

end

Iterator past the last byte of the serialized public key.

operator[]

Access the byte at the given position.

size

Number of bytes in the serialized public key.

Static Member Functions

Name

Description

CheckLowS

Check whether a signature is normalized (lower‐S).

ValidSize

Check whether a byte vector has a valid public key length for its header byte.

Static Data Members

Name

Description

COMPACT_SIGNATURE_SIZE

Size in bytes of a compact (recoverable) ECDSA signature.

COMPRESSED_SIZE

Size in bytes of a compressed public key.

SIGNATURE_SIZE

Maximum size in bytes of a DER‐encoded ECDSA signature.

SIZE

secp256k1:

Friends

Name

Description

operator>

Order two public keys lexicographically by their serialized bytes.

operator<

Order two public keys lexicographically by their serialized bytes.

operator==

Comparator implementation.

Non-Member Functions

Name

Description

CreateMuSig2SyntheticXpub

Construct the BIP 328 synthetic xpub for a pubkey

GetScriptForRawPubKey

Generate a P2PK script for the given pubkey.

HexToPubKey

Parse a hex‐encoded public key, throwing an RPC error if it is invalid.

MuSig2AggregatePubkeys

Compute the full aggregate pubkey from the given participant pubkeys in their current order. Outputs the secp256k1_musig_keyagg_cache and validates that the computed aggregate pubkey matches an expected aggregate pubkey. This is necessary for most MuSig2 operations.

MuSig2AggregatePubkeys

Compute the full aggregate pubkey from the given participant pubkeys in their current order.

MuSig2SessionID

Computes an arbitrary unique session ID to identify ongoing signing sessions. It is the SHA256 of the signing (aggregate) pubkey, the participant pubkey, the sighash, and the pubnonce

Created with MrDocs