XOnlyPubKey

A BIP340-style x-only public key, storing only the 32-byte x coordinate.

Synopsis

Declared in <pubkey.h>

class XOnlyPubKey;

Member Functions

NameDescription
XOnlyPubKey [constructor]Constructors
operator= Copy-assign an x-only pubkey from another.
CheckTapTweak Verify that this is a Taproot tweaked output point, against a specified internal key, Merkle root, and parity.
ComputeTapTweakHash Compute the Taproot tweak as specified in BIP341, with *this as internal key: - if merkle_root == nullptr: H_TapTweak(xonly_pubkey) - otherwise: H_TapTweak(xonly_pubkey || *merkle_root)
CreateTapTweak Construct a Taproot tweaked output point with this point as internal key.
GetCPubKeys Returns this XOnlyPubKey with 0x02 and 0x03 prefixes
GetEvenCorrespondingCPubKey Get the full public key with an even y coordinate (0x02 prefix) for this x-only pubkey.
GetKeyIDs Returns a list of CKeyIDs for the CPubKeys that could have been used to create this XOnlyPubKey. As the CKeyID is the Hash160(full pubkey), the produced CKeyIDs are for the versions of this XOnlyPubKey with 0x02 and 0x03 prefixes. This is needed for key lookups since keys are indexed by CKeyID.
IsFullyValid Determine if this pubkey is fully valid. This is true for approximately 50% of all possible 32-byte arrays. If false, VerifySchnorr, CheckTapTweak and CreateTapTweak will always fail.
IsNull Test whether this is the 0 key (the result of default construction). This implies !IsFullyValid().
VerifySchnorr Verify a Schnorr signature against this public key.
begin begin overloads
data data overloads
end end overloads
operator[] Access the byte at the given position.
operator== Compare two x-only pubkeys for equality.
operator< Order two x-only pubkeys by their key data.

Static Member Functions

NameDescription
size Number of bytes in an x-only public key.

Static Data Members

NameDescription
NUMS_H Nothing Up My Sleeve point H Used as an internal key for provably disabling the key path spend see BIP341 for more details

Derived Classes

NameDescription
WitnessV1Taproot A version-1 taproot destination for a P2TR address.