privkey_to_pubkey

function privkey_to_pubkey(privkey: byte_array, compressed: boolean): byte_array

Compute a public key from a 32-byte private key.

The optional boolean flag compressed determines whether a compressed (33-byte), or uncompressed (65-byte) public key, is returned. Defaults to false (uncompressed) if not provided.

Return

a 65-byte public key in uncompressed mode, or a 33-byte public key in compressed mode

Since

0.10.6

Parameters

privkey

the 32-byte private key

compressed

whether or not the public should be compressed; defaults to false (uncompressed)

Throws

exception

if privkey is not 32 bytes