![]() |
Bitcoin Core
21.99.0
P2P Digital Currency
|
Go to the source code of this file.
Classes | |
class | BaseHash< HashType > |
class | CScriptID |
A reference to a CScript: the Hash160 of its serialization (see script.h) More... | |
class | CNoDestination |
struct | PKHash |
struct | ScriptHash |
struct | WitnessV0ScriptHash |
struct | WitnessV0KeyHash |
struct | WitnessUnknown |
CTxDestination subtype to encode any future Witness version. More... | |
Typedefs | |
using | CTxDestination = std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > |
A txout script template with a specific destination. More... | |
Functions | |
CKeyID | ToKeyID (const PKHash &key_hash) |
CKeyID | ToKeyID (const WitnessV0KeyHash &key_hash) |
bool | IsValidDestination (const CTxDestination &dest) |
Check whether a CTxDestination is a CNoDestination. More... | |
std::string | GetTxnOutputType (TxoutType t) |
Get the name of a TxoutType as a string. More... | |
TxoutType | Solver (const CScript &scriptPubKey, std::vector< std::vector< unsigned char >> &vSolutionsRet) |
Parse a scriptPubKey and identify script type for standard scripts. More... | |
bool | ExtractDestination (const CScript &scriptPubKey, CTxDestination &addressRet) |
Parse a standard scriptPubKey for the destination address. More... | |
bool | ExtractDestinations (const CScript &scriptPubKey, TxoutType &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet) |
Parse a standard scriptPubKey with one or more destination addresses. More... | |
CScript | GetScriptForDestination (const CTxDestination &dest) |
Generate a Bitcoin scriptPubKey for the given CTxDestination. More... | |
CScript | GetScriptForRawPubKey (const CPubKey &pubkey) |
Generate a P2PK script for the given pubkey. More... | |
CScript | GetScriptForMultisig (int nRequired, const std::vector< CPubKey > &keys) |
Generate a multisig script. More... | |
Variables | |
static const bool | DEFAULT_ACCEPT_DATACARRIER = true |
static const unsigned int | MAX_OP_RETURN_RELAY = 83 |
Default setting for nMaxDatacarrierBytes. More... | |
bool | fAcceptDatacarrier |
A data carrying output is an unspendable output containing data. More... | |
unsigned | nMaxDatacarrierBytes |
Maximum size of TxoutType::NULL_DATA scripts that this node considers standard. More... | |
static const unsigned int | MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH |
Mandatory script verification flags that all new blocks must comply with for them to be valid. More... | |
using CTxDestination = std::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown> |
A txout script template with a specific destination.
It is either:
Definition at line 212 of file standard.h.
|
strong |
Definition at line 120 of file standard.h.
bool ExtractDestination | ( | const CScript & | scriptPubKey, |
CTxDestination & | addressRet | ||
) |
Parse a standard scriptPubKey for the destination address.
Assigns result to the addressRet parameter and returns true if successful. For multisig scripts, instead use ExtractDestinations. Currently only works for P2PK, P2PKH, P2SH, P2WPKH, and P2WSH scripts.
Definition at line 180 of file standard.cpp.
bool ExtractDestinations | ( | const CScript & | scriptPubKey, |
TxoutType & | typeRet, | ||
std::vector< CTxDestination > & | addressRet, | ||
int & | nRequiredRet | ||
) |
Parse a standard scriptPubKey with one or more destination addresses.
For multisig scripts, this populates the addressRet vector with the pubkey IDs and nRequiredRet with the n required to spend. For other destinations, addressRet is populated with a single value and nRequiredRet is set to 1. Returns true if successful.
Note: this function confuses destinations (a subset of CScripts that are encodable as an address) with key identifiers (of keys involved in a CScript), and its use should be phased out.
Definition at line 224 of file standard.cpp.
CScript GetScriptForDestination | ( | const CTxDestination & | dest | ) |
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Returns a P2PKH script for a CKeyID destination, a P2SH script for a CScriptID, and an empty script for CNoDestination.
Definition at line 300 of file standard.cpp.
Generate a multisig script.
Definition at line 310 of file standard.cpp.
Generate a P2PK script for the given pubkey.
Definition at line 305 of file standard.cpp.
std::string GetTxnOutputType | ( | TxoutType | t | ) |
Get the name of a TxoutType as a string.
Definition at line 46 of file standard.cpp.
bool IsValidDestination | ( | const CTxDestination & | dest | ) |
Check whether a CTxDestination is a CNoDestination.
Definition at line 321 of file standard.cpp.
TxoutType Solver | ( | const CScript & | scriptPubKey, |
std::vector< std::vector< unsigned char >> & | vSolutionsRet | ||
) |
Parse a scriptPubKey and identify script type for standard scripts.
If successful, returns script type and parsed pubkeys or hashes, depending on the type. For example, for a P2SH script, vSolutionsRet will contain the script hash, for P2PKH it will contain the key hash, etc.
[in] | scriptPubKey | Script to parse |
[out] | vSolutionsRet | Vector of parsed pubkeys and hashes |
Definition at line 110 of file standard.cpp.
CKeyID ToKeyID | ( | const WitnessV0KeyHash & | key_hash | ) |
Definition at line 36 of file standard.cpp.
|
static |
Definition at line 15 of file standard.h.
bool fAcceptDatacarrier |
A data carrying output is an unspendable output containing data.
The script type is designated as TxoutType::NULL_DATA.
Definition at line 16 of file standard.cpp.
|
static |
Mandatory script verification flags that all new blocks must comply with for them to be valid.
(but old blocks may not comply with) Currently just P2SH, but in the future other flags may be added.
Failing one of these tests may trigger a DoS ban - see CheckInputScripts() for details.
Definition at line 118 of file standard.h.
|
static |
Default setting for nMaxDatacarrierBytes.
80 bytes of data, +1 for OP_RETURN, +2 for the pushdata opcodes.
Definition at line 99 of file standard.h.
unsigned nMaxDatacarrierBytes |
Maximum size of TxoutType::NULL_DATA scripts that this node considers standard.
Definition at line 17 of file standard.cpp.