79 std::vector<valtype> &pubkeys) {
96 pubkeys.emplace_back(std::move(data));
102 if (pubkeys.size() != keys || keys < required) {
105 return (it + 1 == script.
end());
109 std::vector<std::vector<uint8_t>> &vSolutionsRet) {
110 vSolutionsRet.clear();
116 std::vector<uint8_t> hashBytes(scriptPubKey.
begin() + 2,
117 scriptPubKey.
begin() + 22);
118 vSolutionsRet.push_back(hashBytes);
127 if (scriptPubKey.
size() >= 1 && scriptPubKey[0] ==
OP_RETURN &&
132 std::vector<uint8_t> data;
134 vSolutionsRet.push_back(std::move(data));
139 vSolutionsRet.push_back(std::move(data));
143 unsigned int required;
144 std::vector<std::vector<uint8_t>> keys;
147 vSolutionsRet.push_back({
static_cast<uint8_t
>(required)});
148 vSolutionsRet.insert(vSolutionsRet.end(), keys.begin(), keys.end());
150 vSolutionsRet.push_back({
static_cast<uint8_t
>(keys.size())});
154 vSolutionsRet.clear();
160 std::vector<valtype> vSolutions;
169 addressRet =
PKHash(pubKey);
185 std::vector<CTxDestination> &addressRet,
188 std::vector<valtype> vSolutions;
189 typeRet =
Solver(scriptPubKey, vSolutions);
198 nRequiredRet = vSolutions.front()[0];
199 for (
size_t i = 1; i < vSolutions.size() - 1; i++) {
206 addressRet.push_back(address);
209 if (addressRet.empty()) {
218 addressRet.push_back(address);
225class CScriptVisitor {
241 return std::visit(CScriptVisitor(), dest);
253 for (
const CPubKey &key : keys) {
261 return dest.index() != 0;
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
static constexpr unsigned int COMPRESSED_SIZE
const uint8_t * end() const
static constexpr unsigned int SIZE
secp256k1:
static bool ValidSize(const std::vector< uint8_t > &vch)
const uint8_t * begin() const
Serialized script, used inside transaction inputs and outputs.
bool IsPushOnly(const_iterator pc) const
Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical).
bool IsPayToScriptHash() const
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
static opcodetype EncodeOP_N(int n)
A reference to a CScript: the Hash160 of its serialization (see script.h)
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
bool CheckMinimalPush(const std::vector< uint8_t > &data, opcodetype opcode)
Check whether the given stack element data would be minimally pushed using the given opcode.
opcodetype
Script opcodes.
std::vector< uint8_t > ToByteVector(const T &in)
std::vector< uint8_t > valtype
std::vector< uint8_t > valtype
static bool MatchPayToPubkeyHash(const CScript &script, valtype &pubkeyhash)
static constexpr bool IsSmallInteger(opcodetype opcode)
Test for "small positive integer" script opcodes - OP_1 through OP_16.
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
bool ExtractDestinations(const CScript &scriptPubKey, TxoutType &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
static bool MatchPayToPubkey(const CScript &script, valtype &pubkey)
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
static bool MatchMultisig(const CScript &script, unsigned int &required, std::vector< valtype > &pubkeys)
CKeyID ToKeyID(const PKHash &key_hash)
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.