ExtractDestination

Parse a scriptPubKey for the destination.

Synopsis

Declared in <addresstype.h>

bool
ExtractDestination(
    CScript const& scriptPubKey,
    CTxDestination& addressRet);

Description

For standard scripts that have addresses (and P2PK as an exception), a corresponding CTxDestination is assigned to addressRet. For all other scripts. addressRet is assigned as a CNoDestination containing the scriptPubKey.

Return Value

True for standard destinations with addresses - P2PKH, P2SH, P2WPKH, P2WSH, P2TR and P2W??? scripts. False for non-standard destinations and those without addresses - P2PK, bare multisig, null data, and nonstandard scripts.

Parameters

NameDescription
scriptPubKeyThe output script to parse.
addressRetReceives the extracted destination.