Serialized script, used inside transaction inputs and outputs
Synopsis
Declared in <script/script.h>
class CScript
: public CScriptBase
Base Classes
Name |
Description |
We use a prevector for the script to reduce the considerable memory overhead of vectors in cases where they normally contain a small number of small elements. |
Member Functions
Name |
Description |
|
Constructs an empty script. |
|
Constructs a script that pushes a single integer. |
|
Constructs a script that holds a single opcode. |
|
Constructs a script that pushes a single script number. |
|
Deleted byte‐vector constructor, to defend against future introduction e.g. via prevector. |
|
Constructs a script from a range of bytes. |
Reads the next opcode, ignoring any pushed data. |
|
Reads the next opcode and its pushed data. |
|
Counts the signature operations in this script. |
|
Accurately count sigOps, including sigOps in pay‐to‐script‐hash transactions: |
|
Returns whether the script contains only valid opcodes. |
|
Returns whether this script is a pay‐to‐anchor (P2A) output script. |
|
Returns whether this script is a pay‐to‐script‐hash (P2SH) output. |
|
Returns whether this script is a pay‐to‐taproot (P2TR) output. |
|
Returns whether this script is a pay‐to‐witness‐script‐hash (P2WSH) output. |
|
Returns whether the whole script only pushes data onto the stack. |
|
Returns whether the script only pushes data onto the stack. |
|
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack. This allows outputs to be pruned instantly when entering the UTXO set. |
|
Returns whether this script is a witness program and extracts its parts. |
|
Empties the script and releases its memory. |
|
Appends a byte span as a data push (uint8_t overload). |
|
Appends a byte span as a data push, including its size prefix. |
|
Appends a script number as pushed data. |
|
Appends a single opcode. |
|
Appends an integer using the most compact push encoding. |
|
|
Delete non‐existent operator to defend against future introduction |
Static Member Functions
Name |
Description |
Decodes a small‐integer opcode to its numeric value. |
|
Encodes a small integer as its push opcode. |
|
Checks if output of IsWitnessProgram comes from a P2A output script |
Protected Member Functions
Name |
Description |
Appends an integer using the most compact push encoding. |
Non-Member Functions
Name |
Description |
Build a script by concatenating other scripts, or any argument accepted by CScript::operator<<. |
|
Compresses a script into the compact on‐disk representation. |
|
Count the signature operations contributed by a witness spend. |
|
Reconstructs a script from its compressed representation. |
|
Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000. |
|
Parse a scriptPubKey for the destination. |
|
Remove every occurrence of a subscript from a script in place. |
|
Format a script as a compact single‐line string for logging and display. |
|
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. |
|
Generate a multisig script. |
|
Generate a P2PK script for the given pubkey. |
|
Find a descriptor for the specified |
|
Determine whether a scriptPubKey uses a standard output form. |
|
Determine if script is a "multi_a" script. Returns (threshold, keyspans) if so, and nullopt otherwise. The keyspans refer to bytes in the passed script. |
|
Parse a human‐readable script (opcodes and push data) into a CScript. |
|
Render a script as a human‐readable assembly string. |
|
Fill a JSON object with a human‐readable description of a script. |
|
Compute the signature hash for one input under the selected signature version. |
|
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. |
|
Verify that an input's scriptSig and witness satisfy the output's scriptPubKey. |
|
Computes the serialization‐agnostic size measure of an output script. |
|
Decodes a Miniscript from a Bitcoin Script. |
Created with MrDocs