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