Class EcKeyPair

Constructors

Properties

BIP32: BIP32API = ...
ECPair: ECPairAPI = ...

Methods

  • Generate a keypair from a private key

    Parameters

    • privateKey: Uint8Array | Buffer

      The private key to use

    • network: Network = networks.bitcoin

      The network to use

    Returns ECPairInterface

    • The generated keypair
  • Generate a keypair from a public key

    Parameters

    • publicKey: Uint8Array | Buffer

      The public key to use

    • network: Network = networks.bitcoin

      The network to use

    Returns ECPairInterface

    • The generated keypair
  • Generate a BIP32 keypair from a seed

    Parameters

    • seed: Buffer

      The seed to generate the keypair from

    • network: Network = networks.bitcoin

      The network to use

    Returns BIP32Interface

    • The generated keypair
  • Get a keypair from a given seed.

    Parameters

    • seed: Buffer

      The seed to generate the key pair from

    • network: Network = networks.bitcoin

      The network to use

    Returns ECPairInterface

    • The generated key pair
  • Generate a keypair from a WIF

    Parameters

    • wif: string

      The WIF to use

    • network: Network = networks.bitcoin

      The network to use

    Returns ECPairInterface

    • The generated keypair
  • Generate a multi-sig address

    Parameters

    • pubKeys: Buffer[]

      The public keys to use

    • minimumSignatureRequired: number

      The minimum number of signatures required

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The generated address
    • If the address cannot be generated
  • Generate a random keypair

    Parameters

    • network: Network = networks.bitcoin

      The network to use

    Returns ECPairInterface

    • The generated keypair
  • Get the legacy address from a keypair

    Parameters

    • keyPair: ECPairInterface

      The keypair to get the address for

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The legacy address
  • Get the legacy segwit address from a keypair

    Parameters

    • keyPair: ECPairInterface

      The keypair to get the address for

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The legacy address
  • Get the legacy address from a keypair

    Parameters

    • keyPair: ECPairInterface

      The keypair to get the address for

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The legacy address
  • Get a P2WPKH address from a keypair

    Parameters

    • keyPair: ECPairInterface

      The keypair to get the address for

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The address
  • Get taproot address from keypair

    Parameters

    • keyPair: ECPairInterface | Signer

      The keypair to get the taproot address for

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The taproot address
  • Get taproot address from address

    Parameters

    • inAddr: string

      The address to convert to taproot

    • network: Network = networks.bitcoin

      The network to use

    Returns string

    • The taproot address
  • Get the address of a tweaked public key

    Parameters

    • tweakedPubKeyBuffer: Uint8Array | Buffer

      The tweaked public key buffer

    • network: Network

      The network to use

    Returns string

    • The address
    • If the address cannot be generated
  • Get the address of a tweaked public key

    Parameters

    • tweakedPubKeyHex: string

      The tweaked public key hex string

    • network: Network

      The network to use

    Returns string

    • The address
    • If the address cannot be generated
  • Tweak a public key

    Parameters

    • compressedPubKeyHex: string

      The compressed public key hex string

    Returns string

    • The tweaked public key hex string
    • If the public key cannot be tweaked
  • Verify that a contract address is a valid p2tr address

    Parameters

    • contractAddress: string

      The contract address to verify

    • network: Network = networks.bitcoin

      The network to use

    Returns boolean

    • Whether the address is valid
  • Verify public keys and return the public keys

    Parameters

    • pubKeys: Buffer[]

      The public keys to verify

    • network: Network = networks.bitcoin

      The network to use

    Returns Buffer[]

    • The verified public keys
    • If the key cannot be regenerated
  • Get the address of a xOnly tweaked public key

    Parameters

    • tweakedPubKeyHex: string

      The xOnly tweaked public key hex string

    • network: Network

      The network to use

    Returns string

    • The address
    • If the address cannot be generated