22 Amount n_abs(sign ? -amount : amount);
23 int64_t quotient = n_abs /
COIN;
26 quotient, remainder));
33 while (it != script.
end()) {
35 std::vector<uint8_t> vch;
36 if (script.
GetOp(it, op, vch)) {
49 if (str.substr(0, 3) == std::string(
"OP_")) {
50 ret += str.substr(3, std::string::npos) +
" ";
57 HexStr(it - vch.size(), it));
69 return ret.substr(0, ret.size() - 1);
77 "ALL|FORKID|ANYONECANPAY"},
82 "NONE|FORKID|ANYONECANPAY"},
87 "SINGLE|FORKID|ANYONECANPAY"},
108 const bool fAttemptSighashDecode) {
111 std::vector<uint8_t> vch;
113 while (pc < script.
end()) {
118 if (!script.
GetOp(pc, opcode, vch)) {
124 if (vch.size() <=
static_cast<std::vector<uint8_t>::size_type
>(4)) {
130 std::string strSigHashDecode;
147 const uint8_t chSigHashType = vch.back();
159 str +=
HexStr(vch) + strSigHashDecode;
182 std::vector<std::vector<uint8_t>> solns;
196 std::vector<CTxDestination> addresses;
210 out.
pushKV(
"reqSigs", nRequired);
217 out.
pushKV(
"addresses", a);
221 bool include_hex,
int serialize_flags) {
229 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
242 in.
pushKV(
"scriptSig", o);
252 for (
unsigned int i = 0; i < tx.
vout.size(); i++) {
258 out.
pushKV(
"n", int64_t(i));
262 out.
pushKV(
"scriptPubKey", o);
266 entry.
pushKV(
"vout", vout);
268 if (!hashBlock.
IsNull()) {
txnouttype Solver(const CScript &scriptPubKey, std::vector< std::vector< uint8_t >> &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex, int serialize_flags)
static constexpr Amount zero()
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags)
const TxId & GetTxId() const
const TxHash GetHash() const
static constexpr Amount SATOSHI
std::string EncodeDestination(const CTxDestination &dest, const Config &config)
Double ended buffer combining vector and stream-like interfaces.
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
const std::map< uint8_t, std::string > mapSigHashTypes
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
const std::vector< CTxIn > vin
size_t GetSerializeSize(const T &t, int nVersion=0)
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode)
Create the assembly string representation of a CScript object.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
opcodetype
Script opcodes.
bool push_back(const UniValue &val)
static constexpr Amount COIN
An input of a transaction.
const std::vector< CTxOut > vout
const char * GetTxnOutputType(txnouttype t)
Get the name of a txnouttype as a C string, or nullptr if unknown.
const Config & GetConfig()
bool pushKV(const std::string &key, const UniValue &val)
An output of a transaction.
std::string FormatScript(const CScript &script)
const char * GetOpName(opcodetype opcode)
const_iterator end() const
const_iterator begin() const
Serialized script, used inside transaction inputs and outputs.
bool CheckTransactionSignatureEncoding(const valtype &vchSig, uint32_t flags, ScriptError *serror)
Check that the signature provided to authentify a transaction is properly encoded.
static const int PROTOCOL_VERSION
network protocol versioning
std::string GetHex() const
std::string HexStr(const T itbegin, const T itend)
std::string SighashToStr(uint8_t sighash_type)
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. ...
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
UniValue ValueFromAmount(const Amount &amount)