Function deriveHdPublicNode

  • Derive the HD public node of an HD private node.

    Though private keys cannot be derived from HD public keys, sharing HD public keys still carries risk. Along with allowing an attacker to associate wallet addresses together (breaking privacy), should an attacker gain knowledge of a single child private key, it's possible to derive all parent HD private keys. See crackHdPrivateNodeFromHdPublicNodeAndChildPrivateNode for details.

    Type Parameters


    • node: PrivateNode

      a valid HD private node

    • crypto: {
          secp256k1: {
              derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array);
      } = ...

      an optional object containing an implementation of secp256k1 compressed public key derivation to use

      • secp256k1: {
            derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array);
        • derivePublicKeyCompressed: ((privateKey: Uint8Array) => string | Uint8Array)
            • (privateKey: Uint8Array): string | Uint8Array
            • Derive a compressed public key from a valid secp256k1 private key.

              Returns an error message if the provided private key is too large (see validatePrivateKey).


              • privateKey: Uint8Array

                a valid secp256k1, 32-byte private key

              Returns string | Uint8Array

    Returns PrivateNode extends HdPrivateNodeKnownParent ? HdPublicNodeKnownParent : HdPublicNode

Generated using TypeDoc