Get the compressed public key.
The 33-byte compressed public key (0x02 or 0x03, x).
Returns the raw public key as a hex string.
The public key as a hex string.
Get the multibase public key.
An object containing the multibase bytes, address and prefix.
Get the parity byte of the public key.
The parity byte of the public key.
Get the uncompressed public key.
The 65-byte uncompressed public key (0x04, x, y).
Get the x-coordinate of the public key.
The 32-byte x-coordinate of the public key.
Get the y-coordinate of the public key.
The 32-byte y-coordinate of the public key.
Decodes the multibase string to the 35-byte corresponding public key (2 byte prefix + 32 byte public key).
The decoded public key: prefix and public key bytes
Encodes compressed secp256k1 public key from bytes to BIP340 multibase format.
The public key encoded in base-58-btc multibase format.
Compares this public key to another public key.
The other public key to compare
True if the public keys are equal, false otherwise.
JSON representation of a PublicKey object.
The PublicKey as a JSON object.
Lifts a 32-byte x-only coordinate into a full secp256k1 point (x, y).
65-byte uncompressed public key (starts with 0x04
)
Computes modular exponentiation: (base^exp) % mod. Used for computing modular square roots.
The base value
The exponent value
The modulus value
The result of the modular exponentiation
Computes sqrt(a) mod p
using Tonelli-Shanks algorithm.
This finds y
such that y^2 ≡ a mod p
.
The value to find the square root of
The prime modulus
The square root of a
mod p
Static
fromJSONCreates a PublicKey object from a JSON representation.
The JSON object to initialize the PublicKey.
The initialized PublicKey object.
Static
fromStatic
pointReturns the point of the public key.
The public key in hex (Uint8Array or string) format.
The point of the public key.
Static
xStatic version of liftX method.
The 32-byte x-coordinate to lift.
The 65-byte uncompressed public key (0x04, x, y).
Encapsulates a secp256k1 public key compliant to BIP-340 BIP schnorr signature scheme. Provides get methods for different formats (compressed, x-only, multibase). Provides helpers methods for comparison and serialization. PublicKey