23 return "OP_PUSHDATA1";
25 return "OP_PUSHDATA2";
27 return "OP_PUSHDATA4";
89 return "OP_TOALTSTACK";
91 return "OP_FROMALTSTACK";
151 return "OP_EQUALVERIFY";
153 return "OP_RESERVED1";
155 return "OP_RESERVED2";
173 return "OP_0NOTEQUAL";
193 return "OP_NUMEQUAL";
195 return "OP_NUMEQUALVERIFY";
197 return "OP_NUMNOTEQUAL";
199 return "OP_LESSTHAN";
201 return "OP_GREATERTHAN";
203 return "OP_LESSTHANOREQUAL";
205 return "OP_GREATERTHANOREQUAL";
215 return "OP_RIPEMD160";
225 return "OP_CODESEPARATOR";
227 return "OP_CHECKSIG";
229 return "OP_CHECKSIGVERIFY";
231 return "OP_CHECKMULTISIG";
233 return "OP_CHECKMULTISIGVERIFY";
235 return "OP_CHECKDATASIG";
237 return "OP_CHECKDATASIGVERIFY";
239 return "OP_REVERSEBYTES";
245 return "OP_CHECKLOCKTIMEVERIFY";
247 return "OP_CHECKSEQUENCEVERIFY";
264 return "OP_INVALIDOPCODE";
274 if (data.size() == 0) {
276 return opcode ==
OP_0;
278 if (data.size() == 1 && data[0] >= 1 && data[0] <= 16) {
282 if (data.size() == 1 && data[0] == 0x81) {
286 if (data.size() <= 75) {
289 return opcode == data.size();
291 if (data.size() <= 255) {
295 if (data.size() <= 65535) {
303 const size_t nMaxNumSize) {
304 if (vch.size() > nMaxNumSize) {
308 if (vch.size() > 0) {
315 if ((vch.back() & 0x7f) == 0) {
321 if (vch.size() <= 1 || (vch[vch.size() - 2] & 0x80) == 0) {
331 if (data.size() == 0) {
336 uint8_t last = data.back();
343 if (data.size() == 1) {
349 if (data[data.size() - 2] & 0x80) {
354 for (
size_t i = data.size() - 1; i > 0; i--) {
356 if (data[i - 1] != 0) {
357 if (data[i - 1] & 0x80) {
379 (*
this)[1] == 0x14 && (*
this)[22] ==
OP_EQUAL);
385 std::vector<uint8_t> &program)
const {
386 if (this->
size() < 4 || this->
size() > 42) {
389 if ((*
this)[0] !=
OP_0 && ((*
this)[0] <
OP_1 || (*
this)[0] >
OP_16)) {
392 if (
size_t((*
this)[1] + 2) == this->
size()) {
394 program = std::vector<uint8_t>(this->
begin() + 2, this->
end());
403 std::vector<uint8_t> program;
410 if (!
GetOp(pc, opcode)) {
418 if (opcode >
OP_16) {
431 std::vector<uint8_t> *pvchRet) {
445 uint32_t opcode = *pc++;
470 if (end - pc < 0 || uint32_t(end - pc) < nSize) {
474 pvchRet->assign(pc, pc + nSize);
487 std::vector<uint8_t> item;
Serialized script, used inside transaction inputs and outputs.
bool IsPayToScriptHash() const
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
bool IsWitnessProgram() const
bool HasValidOps() const
Check if the script contains valid OP_CODES.
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
static bool IsMinimallyEncoded(const std::vector< uint8_t > &vch, const size_t nMaxNumSize)
static bool MinimallyEncode(std::vector< uint8_t > &data)
static uint16_t ReadLE16(const uint8_t *ptr)
static uint32_t ReadLE32(const uint8_t *ptr)
uint160 Hash160(const T1 &in1)
Compute the 160-bit hash an object.
std::string GetOpName(opcodetype opcode)
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.
bool GetScriptOp(CScriptBase::const_iterator &pc, CScriptBase::const_iterator end, opcodetype &opcodeRet, std::vector< uint8_t > *pvchRet)
static const unsigned int MAX_OPCODE
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
opcodetype
Script opcodes.