28 while (it != script.
end()) {
30 std::vector<uint8_t> vch;
31 if (script.
GetOp(it,
op, vch)) {
44 if (str.substr(0, 3) == std::string(
"OP_")) {
45 ret += str.substr(3, std::string::npos) +
" ";
53 HexStr(std::vector<uint8_t>(
it2, it - vch.size())),
54 HexStr(std::vector<uint8_t>(it - vch.size(), it)));
68 return ret.substr(0,
ret.size() - 1);
76 "ALL|FORKID|ANYONECANPAY"},
81 "NONE|FORKID|ANYONECANPAY"},
86 "SINGLE|FORKID|ANYONECANPAY"},
110 std::vector<uint8_t> vch;
112 while (pc < script.
end()) {
117 if (!script.
GetOp(pc, opcode, vch)) {
123 if (vch.size() <=
static_cast<std::vector<uint8_t>::size_type
>(4)) {
179 std::vector<std::vector<uint8_t>>
solns;
238 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
244 in.pushKV(
"txid",
txin.prevout.GetTxId().GetHex());
249 in.pushKV(
"scriptSig",
o);
262 for (
unsigned int i = 0; i < tx.
vout.size(); i++) {
280 entry.
pushKV(
"vout", vout);
288 if (!hashBlock.
IsNull()) {
bool MoneyRange(const Amount nValue)
#define CHECK_NONFATAL(condition)
Identity function.
Double ended buffer combining vector and stream-like interfaces.
Serialized script, used inside transaction inputs and outputs.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxOut > vout
const TxHash GetHash() const
const std::vector< CTxIn > vin
An input of a transaction.
An output of a transaction.
Restore the UTXO in a Coin at a given COutPoint.
void push_back(UniValue val)
void pushKV(std::string key, UniValue val)
std::string GetHex() const
const Config & GetConfig()
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
std::string SighashToStr(uint8_t sighash_type)
std::string FormatScript(const CScript &script)
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode)
Create the assembly string representation of a CScript object.
void TxToUniv(const CTransaction &tx, const BlockHash &hashBlock, UniValue &entry, bool include_hex, int serialize_flags, const CTxUndo *txundo)
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags)
const std::map< uint8_t, std::string > mapSigHashTypes
std::string EncodeDestination(const CTxDestination &dest, const Config &config)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::string GetOpName(opcodetype opcode)
opcodetype
Script opcodes.
@ FIRST_UNDEFINED_OP_VALUE
@ SCRIPT_VERIFY_STRICTENC
@ SCRIPT_ENABLE_SIGHASH_FORKID
size_t GetSerializeSize(const T &t, int nVersion=0)
bool CheckTransactionSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded.
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.
bool ExtractDestinations(const CScript &scriptPubKey, TxoutType &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
static const int PROTOCOL_VERSION
network protocol versioning