btcutil-js - v0.2.0
    Preparing search index...

    Variable addressConst

    address: {
        decode(addr: string, network?: Network): Promise<AddressInfo>;
        fromPubKey(pubKey: Bytes, network?: Network): Promise<string>;
        fromPubKeyHash(hash: Bytes, network?: Network): Promise<string>;
        fromScript(script: Bytes, network?: Network): Promise<string>;
        fromScriptHash(hash: Bytes, network?: Network): Promise<string>;
        fromTaproot(program: Bytes, network?: Network): Promise<string>;
        fromWitnessPubKeyHash(program: Bytes, network?: Network): Promise<string>;
        fromWitnessScriptHash(program: Bytes, network?: Network): Promise<string>;
    } = ...

    Bitcoin address encoding, decoding, and creation.

    Type Declaration

    • decode: function
      • Decode a Bitcoin address string and return detailed info. Calls Go: btcutil.DecodeAddress() from btcutil.

        Parameters

        • addr: string
        • network: Network = 'mainnet'

        Returns Promise<AddressInfo>

    • fromPubKey: function
      • Create a P2PK address from a serialized public key (hex). Calls Go: btcutil.NewAddressPubKey() from btcutil.

        Parameters

        Returns Promise<string>

    • fromPubKeyHash: function
      • Create a P2PKH address from a 20-byte pubkey hash (hex). Calls Go: btcutil.NewAddressPubKeyHash() from btcutil.

        Parameters

        Returns Promise<string>

    • fromScript: function
      • Create a P2SH address by hashing a serialized script (hex). Calls Go: btcutil.NewAddressScriptHash() from btcutil.

        Parameters

        Returns Promise<string>

    • fromScriptHash: function
      • Create a P2SH address from a 20-byte script hash (hex). Calls Go: btcutil.NewAddressScriptHashFromHash() from btcutil.

        Parameters

        Returns Promise<string>

    • fromTaproot: function
      • Create a P2TR (Taproot) address from a 32-byte witness program (hex). Calls Go: btcutil.NewAddressTaproot() from btcutil.

        Parameters

        Returns Promise<string>

    • fromWitnessPubKeyHash: function
      • Create a P2WPKH address from a 20-byte witness program (hex). Calls Go: btcutil.NewAddressWitnessPubKeyHash() from btcutil.

        Parameters

        Returns Promise<string>

    • fromWitnessScriptHash: function
      • Create a P2WSH address from a 32-byte witness program (hex). Calls Go: btcutil.NewAddressWitnessScriptHash() from btcutil.

        Parameters

        Returns Promise<string>