25 while (it != script.
end()) {
27 std::vector<unsigned char> vch;
28 if (script.
GetOp2(it, op, &vch)) {
37 if (str.substr(0, 3) == std::string(
"OP_")) {
38 ret += str.substr(3, std::string::npos) +
" ";
43 ret +=
strprintf(
"0x%x 0x%x ",
HexStr(std::vector<uint8_t>(it2, it - vch.size())),
44 HexStr(std::vector<uint8_t>(it - vch.size(), it)));
53 return ret.substr(0, ret.size() - 1);
57 {
static_cast<unsigned char>(
SIGHASH_ALL), std::string(
"ALL")},
59 {
static_cast<unsigned char>(
SIGHASH_NONE), std::string(
"NONE")},
61 {
static_cast<unsigned char>(
SIGHASH_SINGLE), std::string(
"SINGLE")},
76 std::vector<unsigned char> vch;
78 while (pc < script.
end()) {
82 if (!script.
GetOp(pc, opcode, vch)) {
87 if (vch.size() <=
static_cast<std::vector<unsigned char>::size_type
>(4)) {
92 std::string strSigHashDecode;
98 const unsigned char chSigHashType = vch.back();
100 strSigHashDecode =
"[" +
mapSigHashTypes.find(chSigHashType)->second +
"]";
104 str +=
HexStr(vch) + strSigHashDecode;
128 std::vector<CTxDestination> addresses;
137 out.
pushKV(
"type",
"zerocoinmint");
144 out.
pushKV(
"reqSigs", nRequired);
155 out.
pushKV(
"addresses", a);
185 in.
pushKV(
"scriptSig", o);
193 for (
unsigned int i = 0; i < tx.
vout.size(); i++) {
199 out.
pushKV(
"value", outValue);
200 out.
pushKV(
"n", (int64_t)i);
204 out.
pushKV(
"scriptPubKey", o);
207 entry.
pushKV(
"vout", vout);
213 SpecialTxToJSON(tx, entry);
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(iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet)
bool GetOp2(const_iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > *pvchRet) const
bool IsZerocoinMint() const
The basic transaction that is broadcasted on the network and contained in blocks.
const uint256 & GetHash() const
Optional< std::vector< uint8_t > > extraPayload
std::vector< CTxOut > vout
An input of a transaction.
An output of a transaction.
bool push_back(const UniValue &val)
bool pushKV(const std::string &key, const UniValue &val)
std::string GetHex() const
std::string EncodeHexTx(const CTransaction &tx)
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.
const std::map< unsigned char, std::string > mapSigHashTypes
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry)
bool CheckSignatureEncoding(const std::vector< unsigned char > &vchSig, unsigned int flags, ScriptError *serror)
@ SCRIPT_VERIFY_STRICTENC
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
void TxSaplingToJSON(const CTransaction &tx, UniValue &entry)
const char * GetOpName(opcodetype opcode)
opcodetype
Script opcodes.
unsigned int GetSerializeSize(const std::array< T, N > &item)
array
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
const char * GetTxnOutputType(txnouttype t)
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.