Class: KeyPair 
A keypair represents a private key and its respective public key. It is used for signing data, usually transactions.
Constructors 
new KeyPair() 
new KeyPair(
private_key,public_key):KeyPair
Parameters 
• private_key: PrivateKey
• public_key: PublicKey
Returns 
Defined in 
web.d.ts:1256
Properties 
privateKey 
readonlyprivateKey:PrivateKey
Gets the keypair's private key.
Defined in 
web.d.ts:1286
publicKey 
readonlypublicKey:PublicKey
Gets the keypair's public key.
Defined in 
web.d.ts:1290
Methods 
free() 
free():
void
Returns 
void
Defined in 
web.d.ts:1224
serialize() 
serialize():
Uint8Array
Serializes the keypair to a byte array.
Returns 
Uint8Array
Defined in 
web.d.ts:1261
sign() 
sign(
data):Signature
Signs arbitrary data, returns a signature object.
Parameters 
• data: Uint8Array
Returns 
Defined in 
web.d.ts:1267
signTransaction() 
signTransaction(
transaction):void
Signs a transaction and sets the signature proof on the transaction object.
Parameters 
• transaction: Transaction
Returns 
void
Defined in 
web.d.ts:1272
toAddress() 
toAddress():
Address
Gets the keypair's address.
Returns 
Defined in 
web.d.ts:1277
toHex() 
toHex():
string
Formats the keypair into a hex string.
Returns 
string
Defined in 
web.d.ts:1282
derive() 
staticderive(private_key):KeyPair
Derives a keypair from an existing private key.
Parameters 
• private_key: PrivateKey
Returns 
Defined in 
web.d.ts:1235
fromHex() 
staticfromHex(hex):KeyPair
Parses a keypair from its hex representation.
Throws when the string is not valid hex format or when it represents less than 64 bytes.
Parameters 
• hex: string
Returns 
Defined in 
web.d.ts:1243
generate() 
staticgenerate():KeyPair
Generates a new keypair from secure randomness.
Returns 
Defined in 
web.d.ts:1229
unserialize() 
staticunserialize(bytes):KeyPair
Deserializes a keypair from a byte array.
Throws when the byte array contains less than 64 bytes.
Parameters 
• bytes: Uint8Array
Returns 
Defined in 
web.d.ts:1251