Serializes a Serializable
value to its BCS representation.
This function is the TypeScript SDK equivalent of bcs::to_bytes
in Move.
the BCS representation of the Serializable instance as a byte buffer.
Converts the BCS-serialized bytes of a value into a Hex instance. This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.
A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.
Create a new PrivateKey instance from a Uint8Array or String.
A HexInput (string or Uint8Array)
Optional
strict: booleanIf true, private key must AIP-80 compliant.
Static
Readonly
LENGTHLength of Secp256k1 ecdsa private key
Derive the Secp256k1PublicKey from this private key.
Secp256k1PublicKey The derived public key.
Sign the given message with the private key. This function generates a cryptographic signature for the provided message, ensuring the signature is canonical and non-malleable.
A message in HexInput format to be signed.
Signature - The generated signature for the provided message.
Get the private key as a string representation.
string representation of the private key
Get the private key in bytes (Uint8Array).
Static
fromDerives a private key from a mnemonic seed phrase using a specified BIP44 path.
The BIP44 path to derive the key from.
The mnemonic seed phrase used for key generation.
The generated private key.
Static
generateGenerate a new random private key.
Secp256k1PrivateKey - A newly generated Secp256k1 private key.
Static
isDetermines if the provided private key is an instance of Secp256k1PrivateKey.
The private key to be checked.
Get the private key as a AIP-80 compliant hex string.
AIP-80 compliant string representation of the private key.
Get the private key as a hex string with the 0x prefix.
string representation of the private key.
Returns the hex string representation of the Serializable
value without the 0x prefix.
the hex format as a string without 0x
prefix.
Static
deserialize
Represents a Secp256k1 ECDSA private key, providing functionality to create, sign messages, derive public keys, and serialize/deserialize the key.