20 case OP_0 :
return "0";
26 case OP_1 :
return "1";
27 case OP_2 :
return "2";
28 case OP_3 :
return "3";
29 case OP_4 :
return "4";
30 case OP_5 :
return "5";
31 case OP_6 :
return "6";
32 case OP_7 :
return "7";
33 case OP_8 :
return "8";
34 case OP_9 :
return "9";
35 case OP_10 :
return "10";
36 case OP_11 :
return "11";
37 case OP_12 :
return "12";
38 case OP_13 :
return "13";
39 case OP_14 :
return "14";
40 case OP_15 :
return "15";
41 case OP_16 :
return "16";
44 case OP_NOP :
return "OP_NOP";
45 case OP_VER :
return "OP_VER";
46 case OP_IF :
return "OP_IF";
50 case OP_ELSE :
return "OP_ELSE";
59 case OP_2DUP :
return "OP_2DUP";
60 case OP_3DUP :
return "OP_3DUP";
62 case OP_2ROT :
return "OP_2ROT";
66 case OP_DROP :
return "OP_DROP";
67 case OP_DUP :
return "OP_DUP";
68 case OP_NIP :
return "OP_NIP";
69 case OP_OVER :
return "OP_OVER";
70 case OP_PICK :
return "OP_PICK";
71 case OP_ROLL :
return "OP_ROLL";
72 case OP_ROT :
return "OP_ROT";
73 case OP_SWAP :
return "OP_SWAP";
74 case OP_TUCK :
return "OP_TUCK";
77 case OP_CAT :
return "OP_CAT";
79 case OP_LEFT :
return "OP_LEFT";
81 case OP_SIZE :
return "OP_SIZE";
85 case OP_AND :
return "OP_AND";
86 case OP_OR :
return "OP_OR";
87 case OP_XOR :
return "OP_XOR";
94 case OP_1ADD :
return "OP_1ADD";
95 case OP_1SUB :
return "OP_1SUB";
96 case OP_2MUL :
return "OP_2MUL";
97 case OP_2DIV :
return "OP_2DIV";
99 case OP_ABS :
return "OP_ABS";
100 case OP_NOT :
return "OP_NOT";
102 case OP_ADD :
return "OP_ADD";
103 case OP_SUB :
return "OP_SUB";
104 case OP_MUL :
return "OP_MUL";
105 case OP_DIV :
return "OP_DIV";
106 case OP_MOD :
return "OP_MOD";
118 case OP_MIN :
return "OP_MIN";
119 case OP_MAX :
return "OP_MAX";
124 case OP_SHA1 :
return "OP_SHA1";
135 case OP_NOP1 :
return "OP_NOP1";
138 case OP_NOP4 :
return "OP_NOP4";
139 case OP_NOP5 :
return "OP_NOP5";
140 case OP_NOP6 :
return "OP_NOP6";
141 case OP_NOP7 :
return "OP_NOP7";
142 case OP_NOP8 :
return "OP_NOP8";
143 case OP_NOP9 :
return "OP_NOP9";
170 if (!
GetOp(pc, opcode))
176 if (fAccurate && lastOpcode >=
OP_1 && lastOpcode <=
OP_16)
179 n += MAX_PUBKEYS_PER_MULTISIG;
195 std::vector<unsigned char> vData;
196 while (pc < scriptSig.
end())
199 if (!scriptSig.
GetOp(pc, opcode, vData))
206 CScript subscript(vData.begin(), vData.end());
213 return (this->
size() == 25 &&
216 (*
this)[2] == 0x14 &&
224 return (this->
size() == 23 &&
226 (*
this)[1] == 0x14 &&
234 bool isOwner =
false;
247 if (this->
size() > 30) {
250 if ((*
this)[27] ==
RVN_R) {
251 if ((*
this)[28] ==
RVN_V)
252 if ((*
this)[29] ==
RVN_N)
255 if ((*
this)[28] ==
RVN_R)
256 if ((*
this)[29] ==
RVN_V)
257 if ((*
this)[30] ==
RVN_N)
262 nStartingIndex = index + 1;
263 if ((*
this)[index] ==
RVN_T) {
266 }
else if ((*
this)[index] ==
RVN_Q && this->
size() > 39) {
270 }
else if ((*
this)[index] ==
RVN_O) {
274 }
else if ((*
this)[index] ==
RVN_R) {
289 bool fIsOwner =
false;
299 bool fIsOwner =
false;
309 bool fIsOwner =
false;
319 bool fIsOwner =
false;
333 return (this->
size() > 23 &&
341 return (this->
size() > 6 &&
351 return (this->
size() > 3 &&
361 return (this->
size() == 34 &&
362 (*
this)[0] ==
OP_0 &&
370 if (this->
size() < 4 || this->
size() > 42) {
373 if ((*
this)[0] !=
OP_0 && ((*
this)[0] <
OP_1 || (*
this)[0] >
OP_16)) {
376 if ((
size_t)((*
this)[1] + 2) == this->
size()) {
378 program = std::vector<unsigned char>(this->
begin() + 2, this->
end());
388 if (this->
size() == 35) {
389 return ((*
this)[1] == 0x02 || (*
this)[1] == 0x03) &&
392 if (this->
size() == 67) {
393 return (*
this)[1] == 0x04 &&
405 if (!
GetOp(pc, opcode))
426 std::string ret =
"CScriptWitness(";
427 for (
unsigned int i = 0; i < stack.size(); i++) {
441 std::vector<unsigned char> item;
442 if (!
GetOp(it, opcode, item) || opcode > MAX_OPCODE || item.size() > MAX_SCRIPT_ELEMENT_SIZE) {
464 std::string address =
"";
465 std::string assetName =
"";
468 bool fIsOwner =
false;
499 bool fIsOwner =
false;
500 if (scriptPubKey.
IsAssetScript(nType, fIsOwner, nStartingIndex)) {
510 bool fIsOwner =
false;
511 if (scriptPubKey.
IsAssetScript(nType, fIsOwner, nStartingIndex)) {
521 bool fIsOwner =
false;
522 if (scriptPubKey.
IsAssetScript(nType, fIsOwner, nStartingIndex)) {
532 int nStartingIndex = 0;
536 std::vector<unsigned char> vchNewAsset;
537 vchNewAsset.insert(vchNewAsset.end(), scriptPubKey.
begin() + nStartingIndex, scriptPubKey.
end());
543 }
catch(std::exception& e) {
544 std::cout <<
"Failed to get the asset from the stream: " << e.what() << std::endl;
554 int nStartingIndex = 0;
558 std::vector<unsigned char> vchAsset;
559 vchAsset.insert(vchAsset.end(), scriptPubKey.
begin() + nStartingIndex, scriptPubKey.
end());
565 }
catch(std::exception& e) {
566 std::cout <<
"Failed to get the asset from the stream: " << e.what() << std::endl;
576 int nStartingIndex = 0;
580 std::vector<unsigned char> vchNewAsset;
581 vchNewAsset.insert(vchNewAsset.end(), scriptPubKey.
begin() + nStartingIndex, scriptPubKey.
end());
587 }
catch(std::exception& e) {
588 std::cout <<
"Failed to get the asset from the stream: " << e.what() << std::endl;
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Raven always counted CHECKMULTISIGs as 20 sigops.
#define OWNER_ASSET_AMOUNT
bool IsOwnerAsset() const
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
bool ScriptReissueAsset(const CScript &scriptPubKey, int &nStartingIndex)
bool IsPayToScriptHash() const
bool AmountFromTransferScript(const CScript &scriptPubKey, CAmount &nAmount)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
bool ScriptNewAsset(const CScript &scriptPubKey, int &nStartingIndex)
bool IsReissueAsset() const
bool HasValidOps() const
Check if the script contains valid OP_CODES.
bool IsWitnessProgram(int &version, std::vector< unsigned char > &program) const
Double ended buffer combining vector and stream-like interfaces.
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack...
int64_t CAmount
Amount in corbies (Can be negative)
bool AmountFromNewAssetScript(const CScript &scriptPubKey, CAmount &nAmount)
bool IsPayToPublicKey() const
RVN END.
opcodetype
Script opcodes.
bool AmountFromReissueScript(const CScript &scriptPubKey, CAmount &nAmount)
bool IsTransferAsset() const
bool IsNullAssetVerifierTxDataScript() const
const char * GetOpName(opcodetype opcode)
bool IsNullAssetTxDataScript() const
Serialized script, used inside transaction inputs and outputs.
bool GetAssetAmountFromScript(const CScript &script, CAmount &nAmount)
-----------------------------------------------------------------------------------------------------...
bool GetOp(iterator &pc, opcodetype &opcodeRet, std::vector< unsigned char > &vchRet)
bool ScriptTransferAsset(const CScript &scriptPubKey, int &nStartingIndex)
bool IsAssetScript() const
RVN START.
std::string ToString() const
bool IsPayToPublicKeyHash() const
bool IsNullGlobalRestrictionAssetTxDataScript() const
bool IsPayToWitnessScriptHash() const
RVN END.
bool IsAssetScript(int &nType, bool &fIsOwner, int &nStartingIndex) const