Caravan Documentation
    Preparing search index...

    Struct object for encoding and decoding extended public keys. base58 encoded serialization of the following information: [ version ][ depth ][ parent fingerprint ][ key index ][ chain code ][ pubkey ]

    e.g. m/45'/0'/0

    pubkey found at bip32Path

    chaincode corresponding to pubkey and path

    fingerprint of parent public key

    mainnet or testnet

    the root fingerprint of the device, e.g. 'ca2ab33f'

    import { ExtendedPublicKey } from "@caravan/bitcoin"
    const xpub = ExtendedPublicKey.fromBase58("xpub6CCHViYn5VzKSmKD9cK9LBDPz9wBLV7owXJcNDioETNvhqhVtj3ABnVUERN9aV1RGTX9YpyPHnC4Ekzjnr7TZthsJRBiXA4QCeXNHEwxLab")
    console.log(xpub.encode()) // returns raw Buffer of xpub encoded as per BIP32
    console.log(xpub.toBase58()) // returns base58 check encoded xpub

    Hierarchy

    • unknown
      • ExtendedPublicKey
    Index

    Constructors

    Properties

    base58String?: string
    chaincode?: string
    depth?: number
    index?: number
    network?: BitcoinNetwork
    parentFingerprint?: number
    path?: string
    pubkey?: string
    rootFingerprint?: string
    sequence?: number[]
    version?: KeyVersion

    Methods

    • Sometimes we hop back and forth between a "Rich ExtendedPublicKey" (a Struct with a couple extra parameters set) and the minimal Struct - let's keep the actual string of the Struct around for easy usage in other functions

      Returns void

    • A Buffer Writer used to encode an xpub. This is called by the encode and toBase58 methods

      Parameters

      • bw: BufferWriter

        bufio.BufferWriter

      Returns void

      doesn't have a return, only updates given buffer writer