Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
script.h
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef BITCOIN_SCRIPT_SCRIPT_H
7#define BITCOIN_SCRIPT_SCRIPT_H
8
9#include <attributes.h>
10#include <crypto/common.h>
11#include <prevector.h>
12#include <serialize.h>
13
14#include <cassert>
15#include <climits>
16#include <cstdint>
17#include <cstring>
18#include <limits>
19#include <stdexcept>
20#include <string>
21#include <vector>
22
23// Maximum number of bytes pushable to the stack
24static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520;
25
26// Maximum number of non-push operations per script
27static const int MAX_OPS_PER_SCRIPT = 201;
28
29// Maximum number of public keys per multisig
30static const int MAX_PUBKEYS_PER_MULTISIG = 20;
31
32// Maximum script length in bytes
33static const int MAX_SCRIPT_SIZE = 10000;
34
35// Maximum number of values on script interpreter stack
36static const int MAX_STACK_SIZE = 1000;
37
38// Threshold for nLockTime: below this value it is interpreted as block number,
39// otherwise as UNIX timestamp. Thresold is Tue Nov 5 00:53:20 1985 UTC
40static const unsigned int LOCKTIME_THRESHOLD = 500000000;
41
42template <typename T> std::vector<uint8_t> ToByteVector(const T &in) {
43 return std::vector<uint8_t>(in.begin(), in.end());
44}
45
48 // push value
49 OP_0 = 0x00,
54 OP_1NEGATE = 0x4f,
56 OP_1 = 0x51,
58 OP_2 = 0x52,
59 OP_3 = 0x53,
60 OP_4 = 0x54,
61 OP_5 = 0x55,
62 OP_6 = 0x56,
63 OP_7 = 0x57,
64 OP_8 = 0x58,
65 OP_9 = 0x59,
66 OP_10 = 0x5a,
67 OP_11 = 0x5b,
68 OP_12 = 0x5c,
69 OP_13 = 0x5d,
70 OP_14 = 0x5e,
71 OP_15 = 0x5f,
72 OP_16 = 0x60,
73
74 // control
75 OP_NOP = 0x61,
76 OP_VER = 0x62,
77 OP_IF = 0x63,
78 OP_NOTIF = 0x64,
79 OP_VERIF = 0x65,
81 OP_ELSE = 0x67,
82 OP_ENDIF = 0x68,
83 OP_VERIFY = 0x69,
84 OP_RETURN = 0x6a,
85
86 // stack ops
89 OP_2DROP = 0x6d,
90 OP_2DUP = 0x6e,
91 OP_3DUP = 0x6f,
92 OP_2OVER = 0x70,
93 OP_2ROT = 0x71,
94 OP_2SWAP = 0x72,
95 OP_IFDUP = 0x73,
96 OP_DEPTH = 0x74,
97 OP_DROP = 0x75,
98 OP_DUP = 0x76,
99 OP_NIP = 0x77,
100 OP_OVER = 0x78,
101 OP_PICK = 0x79,
102 OP_ROLL = 0x7a,
103 OP_ROT = 0x7b,
104 OP_SWAP = 0x7c,
105 OP_TUCK = 0x7d,
106
107 // splice ops
108 OP_CAT = 0x7e,
109 OP_SPLIT = 0x7f, // after monolith upgrade (May 2018)
110 OP_NUM2BIN = 0x80, // after monolith upgrade (May 2018)
111 OP_BIN2NUM = 0x81, // after monolith upgrade (May 2018)
112 OP_SIZE = 0x82,
113
114 // bit logic
115 OP_INVERT = 0x83,
116 OP_AND = 0x84,
117 OP_OR = 0x85,
118 OP_XOR = 0x86,
119 OP_EQUAL = 0x87,
123
124 // numeric
125 OP_1ADD = 0x8b,
126 OP_1SUB = 0x8c,
127 OP_2MUL = 0x8d,
128 OP_2DIV = 0x8e,
129 OP_NEGATE = 0x8f,
130 OP_ABS = 0x90,
131 OP_NOT = 0x91,
133
134 OP_ADD = 0x93,
135 OP_SUB = 0x94,
136 OP_MUL = 0x95,
137 OP_DIV = 0x96,
138 OP_MOD = 0x97,
139 OP_LSHIFT = 0x98,
140 OP_RSHIFT = 0x99,
141
143 OP_BOOLOR = 0x9b,
151 OP_MIN = 0xa3,
152 OP_MAX = 0xa4,
153
154 OP_WITHIN = 0xa5,
155
156 // crypto
158 OP_SHA1 = 0xa7,
159 OP_SHA256 = 0xa8,
167
168 // expansion
169 OP_NOP1 = 0xb0,
174 OP_NOP4 = 0xb3,
175 OP_NOP5 = 0xb4,
176 OP_NOP6 = 0xb5,
177 OP_NOP7 = 0xb6,
178 OP_NOP8 = 0xb7,
179 OP_NOP9 = 0xb8,
180 OP_NOP10 = 0xb9,
181
182 // More crypto
185
186 // additional byte string operations
188
189 // The first op_code value after all defined opcodes
191
192 // multi-byte opcodes
195
197};
198
199// Maximum value that an opcode can be
200static const unsigned int MAX_OPCODE = FIRST_UNDEFINED_OP_VALUE - 1;
201
202std::string GetOpName(opcodetype opcode);
203
208bool CheckMinimalPush(const std::vector<uint8_t> &data, opcodetype opcode);
209
210class scriptnum_error : public std::runtime_error {
211public:
212 explicit scriptnum_error(const std::string &str)
213 : std::runtime_error(str) {}
214};
215
226public:
227 static const size_t MAXIMUM_ELEMENT_SIZE = 4;
228
229 explicit CScriptNum(const int64_t &n) { m_value = n; }
230
231 explicit CScriptNum(const std::vector<uint8_t> &vch, bool fRequireMinimal,
232 const size_t nMaxNumSize = MAXIMUM_ELEMENT_SIZE) {
233 if (vch.size() > nMaxNumSize) {
234 throw scriptnum_error("script number overflow");
235 }
237 throw scriptnum_error("non-minimally encoded script number");
238 }
239 m_value = set_vch(vch);
240 }
241
242 static bool IsMinimallyEncoded(
243 const std::vector<uint8_t> &vch,
245
246 static bool MinimallyEncode(std::vector<uint8_t> &data);
247
248 inline bool operator==(const int64_t &rhs) const { return m_value == rhs; }
249 inline bool operator!=(const int64_t &rhs) const { return m_value != rhs; }
250 inline bool operator<=(const int64_t &rhs) const { return m_value <= rhs; }
251 inline bool operator<(const int64_t &rhs) const { return m_value < rhs; }
252 inline bool operator>=(const int64_t &rhs) const { return m_value >= rhs; }
253 inline bool operator>(const int64_t &rhs) const { return m_value > rhs; }
254
255 inline bool operator==(const CScriptNum &rhs) const {
256 return operator==(rhs.m_value);
257 }
258 inline bool operator!=(const CScriptNum &rhs) const {
259 return operator!=(rhs.m_value);
260 }
261 inline bool operator<=(const CScriptNum &rhs) const {
262 return operator<=(rhs.m_value);
263 }
264 inline bool operator<(const CScriptNum &rhs) const {
265 return operator<(rhs.m_value);
266 }
267 inline bool operator>=(const CScriptNum &rhs) const {
268 return operator>=(rhs.m_value);
269 }
270 inline bool operator>(const CScriptNum &rhs) const {
271 return operator>(rhs.m_value);
272 }
273
274 inline CScriptNum operator+(const int64_t &rhs) const {
275 return CScriptNum(m_value + rhs);
276 }
277 inline CScriptNum operator-(const int64_t &rhs) const {
278 return CScriptNum(m_value - rhs);
279 }
280 inline CScriptNum operator+(const CScriptNum &rhs) const {
281 return operator+(rhs.m_value);
282 }
283 inline CScriptNum operator-(const CScriptNum &rhs) const {
284 return operator-(rhs.m_value);
285 }
286
287 inline CScriptNum operator/(const int64_t &rhs) const {
288 return CScriptNum(m_value / rhs);
289 }
290 inline CScriptNum operator/(const CScriptNum &rhs) const {
291 return operator/(rhs.m_value);
292 }
293
294 inline CScriptNum operator%(const int64_t &rhs) const {
295 return CScriptNum(m_value % rhs);
296 }
297 inline CScriptNum operator%(const CScriptNum &rhs) const {
298 return operator%(rhs.m_value);
299 }
300
302 return operator+=(rhs.m_value);
303 }
305 return operator-=(rhs.m_value);
306 }
307
308 inline CScriptNum operator&(const int64_t &rhs) const {
309 return CScriptNum(m_value & rhs);
310 }
311 inline CScriptNum operator&(const CScriptNum &rhs) const {
312 return operator&(rhs.m_value);
313 }
314
316 return operator&=(rhs.m_value);
317 }
318
319 inline CScriptNum operator-() const {
320 assert(m_value != std::numeric_limits<int64_t>::min());
321 return CScriptNum(-m_value);
322 }
323
324 inline CScriptNum &operator=(const int64_t &rhs) {
325 m_value = rhs;
326 return *this;
327 }
328
330 assert(
331 rhs == 0 ||
332 (rhs > 0 && m_value <= std::numeric_limits<int64_t>::max() - rhs) ||
333 (rhs < 0 && m_value >= std::numeric_limits<int64_t>::min() - rhs));
334 m_value += rhs;
335 return *this;
336 }
337
339 assert(
340 rhs == 0 ||
341 (rhs > 0 && m_value >= std::numeric_limits<int64_t>::min() + rhs) ||
342 (rhs < 0 && m_value <= std::numeric_limits<int64_t>::max() + rhs));
343 m_value -= rhs;
344 return *this;
345 }
346
348 m_value &= rhs;
349 return *this;
350 }
351
352 int64_t getint() const { return m_value; }
353
354 std::vector<uint8_t> getvch() const { return serialize(m_value); }
355
356 static std::vector<uint8_t> serialize(const int64_t &value) {
357 if (value == 0) {
358 return {};
359 }
360
361 std::vector<uint8_t> result;
362 const bool neg = value < 0;
364 : static_cast<uint64_t>(value);
365
366 while (absvalue) {
367 result.push_back(absvalue & 0xff);
368 absvalue >>= 8;
369 }
370
371 // - If the most significant byte is >= 0x80 and the value is positive,
372 // push a new zero-byte to make the significant byte < 0x80 again.
373 // - If the most significant byte is >= 0x80 and the value is negative,
374 // push a new 0x80 byte that will be popped off when converting to an
375 // integral.
376 // - If the most significant byte is < 0x80 and the value is negative,
377 // add 0x80 to it, since it will be subtracted and interpreted as a
378 // negative when converting to an integral.
379 if (result.back() & 0x80) {
380 result.push_back(neg ? 0x80 : 0);
381 } else if (neg) {
382 result.back() |= 0x80;
383 }
384
385 return result;
386 }
387
388private:
389 static int64_t set_vch(const std::vector<uint8_t> &vch) {
390 if (vch.empty()) {
391 return 0;
392 }
393
394 int64_t result = 0;
395 for (size_t i = 0; i != vch.size(); ++i) {
396 result |= int64_t(vch[i]) << 8 * i;
397 }
398
399 // If the input vector's most significant byte is 0x80, remove it from
400 // the result's msb and return a negative.
401 if (vch.back() & 0x80) {
402 return -int64_t(result & ~(0x80ULL << (8 * (vch.size() - 1))));
403 }
404
405 return result;
406 }
407
409};
410
418
421 std::vector<uint8_t> *pvchRet);
422
424class CScript : public CScriptBase {
425protected:
427 if (n == -1 || (n >= 1 && n <= 16)) {
428 push_back(n + (OP_1 - 1));
429 } else if (n == 0) {
431 } else {
432 *this << CScriptNum::serialize(n);
433 }
434 return *this;
435 }
436
437public:
441 CScript(std::vector<uint8_t>::const_iterator pbegin,
442 std::vector<uint8_t>::const_iterator pend)
443 : CScriptBase(pbegin, pend) {}
444 CScript(const uint8_t *pbegin, const uint8_t *pend)
445 : CScriptBase(pbegin, pend) {}
446
448
449 explicit CScript(int64_t b) { operator<<(b); }
451 explicit CScript(const CScriptNum &b) { operator<<(b); }
452 // delete non-existent constructor to defend against future introduction
453 // e.g. via prevector
454 explicit CScript(const std::vector<uint8_t> &b) = delete;
455
457 CScript &operator<<(const CScript &b) = delete;
458
460
462 if (opcode < 0 || opcode > 0xff) {
463 throw std::runtime_error("CScript::operator<<(): invalid opcode");
464 }
465 insert(end(), uint8_t(opcode));
466 return *this;
467 }
468
470 *this << b.getvch();
471 return *this;
472 }
473
474 CScript &operator<<(const std::vector<uint8_t> &b) LIFETIMEBOUND {
475 if (b.size() < OP_PUSHDATA1) {
476 insert(end(), uint8_t(b.size()));
477 } else if (b.size() <= 0xff) {
479 insert(end(), uint8_t(b.size()));
480 } else if (b.size() <= 0xffff) {
482 uint8_t _data[2];
483 WriteLE16(_data, b.size());
484 insert(end(), _data, _data + sizeof(_data));
485 } else {
487 uint8_t _data[4];
488 WriteLE32(_data, b.size());
489 insert(end(), _data, _data + sizeof(_data));
490 }
491 insert(end(), b.begin(), b.end());
492 return *this;
493 }
494
496 std::vector<uint8_t> &vchRet) const {
497 return GetScriptOp(pc, end(), opcodeRet, &vchRet);
498 }
499
501 return GetScriptOp(pc, end(), opcodeRet, nullptr);
502 }
503
505 static int DecodeOP_N(opcodetype opcode) {
506 if (opcode == OP_0) {
507 return 0;
508 }
509
510 assert(opcode >= OP_1 && opcode <= OP_16);
511 return int(opcode) - int(OP_1 - 1);
512 }
513 static opcodetype EncodeOP_N(int n) {
514 assert(n >= 0 && n <= 16);
515 if (n == 0) {
516 return OP_0;
517 }
518
519 return (opcodetype)(OP_1 + n - 1);
520 }
521
522 bool IsPayToScriptHash() const;
523 bool IsWitnessProgram(int &version, std::vector<uint8_t> &program) const;
524 bool IsWitnessProgram() const;
525
530 bool IsPushOnly(const_iterator pc) const;
531 bool IsPushOnly() const;
532
534 bool HasValidOps() const;
535
541 bool IsUnspendable() const {
542 return (size() > 0 && *begin() == OP_RETURN) ||
543 (size() > MAX_SCRIPT_SIZE);
544 }
545
546 void clear() {
547 // The default prevector::clear() does not release memory
550 }
551};
552
553#endif // BITCOIN_SCRIPT_SCRIPT_H
#define LIFETIMEBOUND
Definition attributes.h:16
Serialized script, used inside transaction inputs and outputs.
Definition script.h:424
CScript(const_iterator pbegin, const_iterator pend)
Definition script.h:439
bool IsPayToScriptHash() const
Definition script.cpp:373
bool IsUnspendable() const
Returns whether the script is guaranteed to fail at execution, regardless of the initial stack.
Definition script.h:541
CScript & operator<<(const CScript &b)=delete
Delete non-existent operator to defend against future introduction.
CScript(const CScriptNum &b)
Definition script.h:451
CScript(const uint8_t *pbegin, const uint8_t *pend)
Definition script.h:444
CScript & push_int64(int64_t n)
Definition script.h:426
CScript(int64_t b)
Definition script.h:449
SERIALIZE_METHODS(CScript, obj)
Definition script.h:447
CScript(std::vector< uint8_t >::const_iterator pbegin, std::vector< uint8_t >::const_iterator pend)
Definition script.h:441
void clear()
Definition script.h:546
static int DecodeOP_N(opcodetype opcode)
Encode/decode small integers:
Definition script.h:505
bool IsPushOnly() const
Definition script.cpp:422
bool IsWitnessProgram() const
Definition script.cpp:398
CScript(opcodetype b)
Definition script.h:450
CScript()
Definition script.h:438
CScript & operator<<(const std::vector< uint8_t > &b) LIFETIMEBOUND
Definition script.h:474
bool HasValidOps() const
Check if the script contains valid OP_CODES.
Definition script.cpp:480
bool GetOp(const_iterator &pc, opcodetype &opcodeRet) const
Definition script.h:500
CScript & operator<<(opcodetype opcode) LIFETIMEBOUND
Definition script.h:461
CScript & operator<<(const CScriptNum &b) LIFETIMEBOUND
Definition script.h:469
bool GetOp(const_iterator &pc, opcodetype &opcodeRet, std::vector< uint8_t > &vchRet) const
Definition script.h:495
CScript(const std::vector< uint8_t > &b)=delete
CScript & operator<<(int64_t b) LIFETIMEBOUND
Definition script.h:459
static opcodetype EncodeOP_N(int n)
Definition script.h:513
int64_t m_value
Definition script.h:408
CScriptNum & operator-=(const CScriptNum &rhs)
Definition script.h:304
CScriptNum & operator-=(const int64_t &rhs)
Definition script.h:338
CScriptNum operator-(const int64_t &rhs) const
Definition script.h:277
bool operator<(const CScriptNum &rhs) const
Definition script.h:264
CScriptNum operator+(const int64_t &rhs) const
Definition script.h:274
CScriptNum & operator+=(const CScriptNum &rhs)
Definition script.h:301
CScriptNum operator-(const CScriptNum &rhs) const
Definition script.h:283
bool operator>(const CScriptNum &rhs) const
Definition script.h:270
bool operator==(const CScriptNum &rhs) const
Definition script.h:255
int64_t getint() const
Definition script.h:352
static std::vector< uint8_t > serialize(const int64_t &value)
Definition script.h:356
CScriptNum & operator&=(const CScriptNum &rhs)
Definition script.h:315
std::vector< uint8_t > getvch() const
Definition script.h:354
bool operator<=(const CScriptNum &rhs) const
Definition script.h:261
bool operator==(const int64_t &rhs) const
Definition script.h:248
bool operator<(const int64_t &rhs) const
Definition script.h:251
CScriptNum(const std::vector< uint8_t > &vch, bool fRequireMinimal, const size_t nMaxNumSize=MAXIMUM_ELEMENT_SIZE)
Definition script.h:231
CScriptNum operator%(const int64_t &rhs) const
Definition script.h:294
CScriptNum operator&(const int64_t &rhs) const
Definition script.h:308
CScriptNum operator&(const CScriptNum &rhs) const
Definition script.h:311
CScriptNum & operator+=(const int64_t &rhs)
Definition script.h:329
bool operator>=(const int64_t &rhs) const
Definition script.h:252
bool operator<=(const int64_t &rhs) const
Definition script.h:250
CScriptNum operator%(const CScriptNum &rhs) const
Definition script.h:297
CScriptNum(const int64_t &n)
Definition script.h:229
static bool MinimallyEncode(std::vector< uint8_t > &data)
Definition script.cpp:327
bool operator!=(const int64_t &rhs) const
Definition script.h:249
bool operator>=(const CScriptNum &rhs) const
Definition script.h:267
bool operator>(const int64_t &rhs) const
Definition script.h:253
CScriptNum & operator&=(const int64_t &rhs)
Definition script.h:347
static int64_t set_vch(const std::vector< uint8_t > &vch)
Definition script.h:389
static const size_t MAXIMUM_ELEMENT_SIZE
Numeric opcodes (OP_1ADD, etc) are restricted to operating on 4-byte integers.
Definition script.h:227
CScriptNum operator/(const CScriptNum &rhs) const
Definition script.h:290
CScriptNum operator/(const int64_t &rhs) const
Definition script.h:287
CScriptNum operator-() const
Definition script.h:319
bool operator!=(const CScriptNum &rhs) const
Definition script.h:258
CScriptNum & operator=(const int64_t &rhs)
Definition script.h:324
static bool IsMinimallyEncoded(const std::vector< uint8_t > &vch, const size_t nMaxNumSize=CScriptNum::MAXIMUM_ELEMENT_SIZE)
Definition script.cpp:299
CScriptNum operator+(const CScriptNum &rhs) const
Definition script.h:280
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
Definition prevector.h:38
void shrink_to_fit()
Definition prevector.h:447
void clear()
Definition prevector.h:449
size_type size() const
Definition prevector.h:394
iterator begin()
Definition prevector.h:398
iterator end()
Definition prevector.h:400
iterator insert(iterator pos, const T &value)
Definition prevector.h:451
void push_back(const T &value)
Definition prevector.h:539
scriptnum_error(const std::string &str)
Definition script.h:212
static void WriteLE16(uint8_t *ptr, uint16_t x)
Definition common.h:35
static void WriteLE32(uint8_t *ptr, uint32_t x)
Definition common.h:40
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition rcu.h:259
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...
Definition random.h:85
static const unsigned int LOCKTIME_THRESHOLD
Definition script.h:40
static const unsigned int MAX_OPCODE
Definition script.h:200
std::string GetOpName(opcodetype opcode)
Definition script.cpp:14
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
Definition script.h:24
static const int MAX_SCRIPT_SIZE
Definition script.h:33
opcodetype
Script opcodes.
Definition script.h:47
@ OP_NUMNOTEQUAL
Definition script.h:146
@ OP_RESERVED1
Definition script.h:121
@ OP_SPLIT
Definition script.h:109
@ OP_2
Definition script.h:58
@ OP_SHA256
Definition script.h:159
@ OP_PUSHDATA4
Definition script.h:53
@ OP_NOP5
Definition script.h:175
@ OP_CHECKDATASIG
Definition script.h:183
@ OP_BOOLAND
Definition script.h:142
@ OP_CHECKMULTISIG
Definition script.h:165
@ OP_NEGATE
Definition script.h:129
@ OP_IF
Definition script.h:77
@ OP_13
Definition script.h:69
@ OP_ROT
Definition script.h:103
@ OP_SWAP
Definition script.h:104
@ OP_1NEGATE
Definition script.h:54
@ OP_VERNOTIF
Definition script.h:80
@ OP_CHECKSIG
Definition script.h:163
@ OP_CHECKLOCKTIMEVERIFY
Definition script.h:170
@ OP_LESSTHAN
Definition script.h:147
@ OP_16
Definition script.h:72
@ OP_14
Definition script.h:70
@ OP_CHECKDATASIGVERIFY
Definition script.h:184
@ OP_NOP10
Definition script.h:180
@ OP_2DIV
Definition script.h:128
@ OP_INVALIDOPCODE
Definition script.h:196
@ OP_NOT
Definition script.h:131
@ OP_EQUAL
Definition script.h:119
@ OP_NUMEQUAL
Definition script.h:144
@ OP_MOD
Definition script.h:138
@ OP_NOTIF
Definition script.h:78
@ OP_4
Definition script.h:60
@ OP_10
Definition script.h:66
@ OP_SIZE
Definition script.h:112
@ OP_3DUP
Definition script.h:91
@ FIRST_UNDEFINED_OP_VALUE
Definition script.h:190
@ OP_ENDIF
Definition script.h:82
@ OP_NOP1
Definition script.h:169
@ OP_DUP
Definition script.h:98
@ OP_GREATERTHAN
Definition script.h:148
@ OP_NOP
Definition script.h:75
@ OP_NOP2
Definition script.h:171
@ OP_NUM2BIN
Definition script.h:110
@ OP_VERIF
Definition script.h:79
@ OP_TOALTSTACK
Definition script.h:87
@ OP_CODESEPARATOR
Definition script.h:162
@ OP_RIPEMD160
Definition script.h:157
@ OP_MIN
Definition script.h:151
@ OP_HASH256
Definition script.h:161
@ OP_MAX
Definition script.h:152
@ OP_1SUB
Definition script.h:126
@ OP_PREFIX_BEGIN
Definition script.h:193
@ OP_FROMALTSTACK
Definition script.h:88
@ OP_SUB
Definition script.h:135
@ OP_FALSE
Definition script.h:50
@ OP_NUMEQUALVERIFY
Definition script.h:145
@ OP_OVER
Definition script.h:100
@ OP_NOP8
Definition script.h:178
@ OP_DIV
Definition script.h:137
@ OP_HASH160
Definition script.h:160
@ OP_2DUP
Definition script.h:90
@ OP_NIP
Definition script.h:99
@ OP_2MUL
Definition script.h:127
@ OP_NOP4
Definition script.h:174
@ OP_NOP3
Definition script.h:173
@ OP_1
Definition script.h:56
@ OP_LESSTHANOREQUAL
Definition script.h:149
@ OP_2DROP
Definition script.h:89
@ OP_TRUE
Definition script.h:57
@ OP_DEPTH
Definition script.h:96
@ OP_NOP9
Definition script.h:179
@ OP_BIN2NUM
Definition script.h:111
@ OP_VER
Definition script.h:76
@ OP_VERIFY
Definition script.h:83
@ OP_RESERVED2
Definition script.h:122
@ OP_12
Definition script.h:68
@ OP_ADD
Definition script.h:134
@ OP_CHECKMULTISIGVERIFY
Definition script.h:166
@ OP_NOP7
Definition script.h:177
@ OP_8
Definition script.h:64
@ OP_BOOLOR
Definition script.h:143
@ OP_XOR
Definition script.h:118
@ OP_DROP
Definition script.h:97
@ OP_MUL
Definition script.h:136
@ OP_WITHIN
Definition script.h:154
@ OP_ELSE
Definition script.h:81
@ OP_15
Definition script.h:71
@ OP_CHECKSIGVERIFY
Definition script.h:164
@ OP_PUSHDATA1
Definition script.h:51
@ OP_TUCK
Definition script.h:105
@ OP_2OVER
Definition script.h:92
@ OP_0NOTEQUAL
Definition script.h:132
@ OP_9
Definition script.h:65
@ OP_3
Definition script.h:59
@ OP_11
Definition script.h:67
@ OP_PREFIX_END
Definition script.h:194
@ OP_SHA1
Definition script.h:158
@ OP_GREATERTHANOREQUAL
Definition script.h:150
@ OP_RSHIFT
Definition script.h:140
@ OP_2SWAP
Definition script.h:94
@ OP_PUSHDATA2
Definition script.h:52
@ OP_2ROT
Definition script.h:93
@ OP_6
Definition script.h:62
@ OP_INVERT
Definition script.h:115
@ OP_0
Definition script.h:49
@ OP_ABS
Definition script.h:130
@ OP_LSHIFT
Definition script.h:139
@ OP_RETURN
Definition script.h:84
@ OP_IFDUP
Definition script.h:95
@ OP_PICK
Definition script.h:101
@ OP_AND
Definition script.h:116
@ OP_EQUALVERIFY
Definition script.h:120
@ OP_CAT
Definition script.h:108
@ OP_REVERSEBYTES
Definition script.h:187
@ OP_RESERVED
Definition script.h:55
@ OP_1ADD
Definition script.h:125
@ OP_7
Definition script.h:63
@ OP_OR
Definition script.h:117
@ OP_ROLL
Definition script.h:102
@ OP_NOP6
Definition script.h:176
@ OP_5
Definition script.h:61
@ OP_CHECKSEQUENCEVERIFY
Definition script.h:172
prevector< 28, uint8_t > CScriptBase
We use a prevector for the script to reduce the considerable memory overhead of vectors in cases wher...
Definition script.h:417
static const int MAX_STACK_SIZE
Definition script.h:36
static const int MAX_OPS_PER_SCRIPT
Definition script.h:27
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.
Definition script.cpp:268
static const int MAX_PUBKEYS_PER_MULTISIG
Definition script.h:30
std::vector< uint8_t > ToByteVector(const T &in)
Definition script.h:42
bool GetScriptOp(CScriptBase::const_iterator &pc, CScriptBase::const_iterator end, opcodetype &opcodeRet, std::vector< uint8_t > *pvchRet)
Definition script.cpp:426
#define READWRITEAS(type, obj)
Definition serialize.h:167
assert(!tx.IsCoinBase())