Caravan Documentation
    Preparing search index...

    Function getFingerprintFromPublicKey

    • Get fingerprint for a given pubkey. This is useful for generating xpubs which need the fingerprint of the parent pubkey. If not a compressed key then this function will attempt to compress it.

      Parameters

      • _pubkey: string

        pubkey to derive fingerprint from

      Returns number

      fingerprint

      import {getFingerprintFromPublicKey} from "@caravan/bitcoin"
      const pubkey = "03b32dc780fba98db25b4b72cf2b69da228f5e10ca6aa8f46eabe7f9fe22c994ee"
      console.log(getFingerprintFromPublicKey(pubkey)) // 724365675

      const uncompressedPubkey = "04dccdc7fc599ed379c415fc2bb398b1217f0142af23692359057094ce306cd3930e6634c71788b9ed283219ca2fea102aaf137cd74e025cce97b94478a02029cf"
      console.log(getFingerprintFromPublicKey(uncompressedPubkey)) // 247110101