Key Creation

Key Creation

Key creation requires first creating a private key and then deriving a public key. The public key is the public identity of the spender and is used to generate the address. The private key is used to privately generate a signature and authorize a withdrawal.

Library Imports

import * as secp from '@noble/secp256k1'

Generating a Private Key

const privateKey = secp.utils.randomPrivateKey()

Deriving an ECDSA Public Key from a Private Key

const ecdsaPublicKey = secp.getPublicKey(privateKey, true)

Deriving a Schnorr Public Key from a Private Key

const schnorrPublicKey = secp.schnorr.getPublicKey(privateKey)