• Returns the address an output script pays to.

    Standard scripts (P2PKH, P2SH, P2WPKH, P2WSH, P2TR and future segwit versions) map to their address. A name output maps to the address of the owner's script behind its name prefix, see nameScriptOwner.

    Parameters

    • output: Buffer

      The output script.

    • Optional network: Network

      The network whose address prefixes to use. Defaults to Bitcoin.

    Returns string

    The address.

    Throws

    If the script does not pay to an address.