bc/opcodes.rs
1// Bitcoin protocol consensus library.
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5// Written in 2019-2024 by
6// Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
7//
8// Copyright (C) 2019-2024 LNP/BP Standards Association. All rights reserved.
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21
22use crate::LIB_NAME_BITCOIN;
23
24/// Push an empty array onto the stack.
25///
26/// Also, a synonym for `OP_0` and `OP_FALSE`.
27pub const OP_PUSHBYTES_0: u8 = 0x00;
28/// Push the next byte as an array onto the stack.
29pub const OP_PUSHBYTES_1: u8 = 0x01;
30/// Push the next 2 bytes as an array onto the stack.
31pub const OP_PUSHBYTES_2: u8 = 0x02;
32/// Push the next 3 bytes as an array onto the stack.
33pub const OP_PUSHBYTES_3: u8 = 0x03;
34/// Push the next 4 bytes as an array onto the stack.
35pub const OP_PUSHBYTES_4: u8 = 0x04;
36/// Push the next 5 bytes as an array onto the stack.
37pub const OP_PUSHBYTES_5: u8 = 0x05;
38/// Push the next 6 bytes as an array onto the stack.
39pub const OP_PUSHBYTES_6: u8 = 0x06;
40/// Push the next 7 bytes as an array onto the stack.
41pub const OP_PUSHBYTES_7: u8 = 0x07;
42/// Push the next 8 bytes as an array onto the stack.
43pub const OP_PUSHBYTES_8: u8 = 0x08;
44/// Push the next 9 bytes as an array onto the stack.
45pub const OP_PUSHBYTES_9: u8 = 0x09;
46/// Push the next 10 bytes as an array onto the stack.
47pub const OP_PUSHBYTES_10: u8 = 0x0a;
48/// Push the next 11 bytes as an array onto the stack.
49pub const OP_PUSHBYTES_11: u8 = 0x0b;
50/// Push the next 12 bytes as an array onto the stack.
51pub const OP_PUSHBYTES_12: u8 = 0x0c;
52/// Push the next 13 bytes as an array onto the stack.
53pub const OP_PUSHBYTES_13: u8 = 0x0d;
54/// Push the next 14 bytes as an array onto the stack.
55pub const OP_PUSHBYTES_14: u8 = 0x0e;
56/// Push the next 15 bytes as an array onto the stack.
57pub const OP_PUSHBYTES_15: u8 = 0x0f;
58/// Push the next 16 bytes as an array onto the stack.
59pub const OP_PUSHBYTES_16: u8 = 0x10;
60/// Push the next 17 bytes as an array onto the stack.
61pub const OP_PUSHBYTES_17: u8 = 0x11;
62/// Push the next 18 bytes as an array onto the stack.
63pub const OP_PUSHBYTES_18: u8 = 0x12;
64/// Push the next 19 bytes as an array onto the stack.
65pub const OP_PUSHBYTES_19: u8 = 0x13;
66/// Push the next 20 bytes as an array onto the stack.
67pub const OP_PUSHBYTES_20: u8 = 0x14;
68/// Push the next 21 bytes as an array onto the stack.
69pub const OP_PUSHBYTES_21: u8 = 0x15;
70/// Push the next 22 bytes as an array onto the stack.
71pub const OP_PUSHBYTES_22: u8 = 0x16;
72/// Push the next 23 bytes as an array onto the stack.
73pub const OP_PUSHBYTES_23: u8 = 0x17;
74/// Push the next 24 bytes as an array onto the stack.
75pub const OP_PUSHBYTES_24: u8 = 0x18;
76/// Push the next 25 bytes as an array onto the stack.
77pub const OP_PUSHBYTES_25: u8 = 0x19;
78/// Push the next 26 bytes as an array onto the stack.
79pub const OP_PUSHBYTES_26: u8 = 0x1a;
80/// Push the next 27 bytes as an array onto the stack.
81pub const OP_PUSHBYTES_27: u8 = 0x1b;
82/// Push the next 28 bytes as an array onto the stack.
83pub const OP_PUSHBYTES_28: u8 = 0x1c;
84/// Push the next 29 bytes as an array onto the stack.
85pub const OP_PUSHBYTES_29: u8 = 0x1d;
86/// Push the next 30 bytes as an array onto the stack.
87pub const OP_PUSHBYTES_30: u8 = 0x1e;
88/// Push the next 31 bytes as an array onto the stack.
89pub const OP_PUSHBYTES_31: u8 = 0x1f;
90/// Push the next 32 bytes as an array onto the stack.
91pub const OP_PUSHBYTES_32: u8 = 0x20;
92/// Push the next 33 bytes as an array onto the stack.
93pub const OP_PUSHBYTES_33: u8 = 0x21;
94/// Push the next 34 bytes as an array onto the stack.
95pub const OP_PUSHBYTES_34: u8 = 0x22;
96/// Push the next 35 bytes as an array onto the stack.
97pub const OP_PUSHBYTES_35: u8 = 0x23;
98/// Push the next 36 bytes as an array onto the stack.
99pub const OP_PUSHBYTES_36: u8 = 0x24;
100/// Push the next 37 bytes as an array onto the stack.
101pub const OP_PUSHBYTES_37: u8 = 0x25;
102/// Push the next 38 bytes as an array onto the stack.
103pub const OP_PUSHBYTES_38: u8 = 0x26;
104/// Push the next 39 bytes as an array onto the stack.
105pub const OP_PUSHBYTES_39: u8 = 0x27;
106/// Push the next 40 bytes as an array onto the stack.
107pub const OP_PUSHBYTES_40: u8 = 0x28;
108/// Push the next 41 bytes as an array onto the stack.
109pub const OP_PUSHBYTES_41: u8 = 0x29;
110/// Push the next 42 bytes as an array onto the stack.
111pub const OP_PUSHBYTES_42: u8 = 0x2a;
112/// Push the next 43 bytes as an array onto the stack.
113pub const OP_PUSHBYTES_43: u8 = 0x2b;
114/// Push the next 44 bytes as an array onto the stack.
115pub const OP_PUSHBYTES_44: u8 = 0x2c;
116/// Push the next 45 bytes as an array onto the stack.
117pub const OP_PUSHBYTES_45: u8 = 0x2d;
118/// Push the next 46 bytes as an array onto the stack.
119pub const OP_PUSHBYTES_46: u8 = 0x2e;
120/// Push the next 47 bytes as an array onto the stack.
121pub const OP_PUSHBYTES_47: u8 = 0x2f;
122/// Push the next 48 bytes as an array onto the stack.
123pub const OP_PUSHBYTES_48: u8 = 0x30;
124/// Push the next 49 bytes as an array onto the stack.
125pub const OP_PUSHBYTES_49: u8 = 0x31;
126/// Push the next 50 bytes as an array onto the stack.
127pub const OP_PUSHBYTES_50: u8 = 0x32;
128/// Push the next 51 bytes as an array onto the stack.
129pub const OP_PUSHBYTES_51: u8 = 0x33;
130/// Push the next 52 bytes as an array onto the stack.
131pub const OP_PUSHBYTES_52: u8 = 0x34;
132/// Push the next 53 bytes as an array onto the stack.
133pub const OP_PUSHBYTES_53: u8 = 0x35;
134/// Push the next 54 bytes as an array onto the stack.
135pub const OP_PUSHBYTES_54: u8 = 0x36;
136/// Push the next 55 bytes as an array onto the stack.
137pub const OP_PUSHBYTES_55: u8 = 0x37;
138/// Push the next 56 bytes as an array onto the stack.
139pub const OP_PUSHBYTES_56: u8 = 0x38;
140/// Push the next 57 bytes as an array onto the stack.
141pub const OP_PUSHBYTES_57: u8 = 0x39;
142/// Push the next 58 bytes as an array onto the stack.
143pub const OP_PUSHBYTES_58: u8 = 0x3a;
144/// Push the next 59 bytes as an array onto the stack.
145pub const OP_PUSHBYTES_59: u8 = 0x3b;
146/// Push the next 60 bytes as an array onto the stack.
147pub const OP_PUSHBYTES_60: u8 = 0x3c;
148/// Push the next 61 bytes as an array onto the stack.
149pub const OP_PUSHBYTES_61: u8 = 0x3d;
150/// Push the next 62 bytes as an array onto the stack.
151pub const OP_PUSHBYTES_62: u8 = 0x3e;
152/// Push the next 63 bytes as an array onto the stack.
153pub const OP_PUSHBYTES_63: u8 = 0x3f;
154/// Push the next 64 bytes as an array onto the stack.
155pub const OP_PUSHBYTES_64: u8 = 0x40;
156/// Push the next 65 bytes as an array onto the stack.
157pub const OP_PUSHBYTES_65: u8 = 0x41;
158/// Push the next 66 bytes as an array onto the stack.
159pub const OP_PUSHBYTES_66: u8 = 0x42;
160/// Push the next 67 bytes as an array onto the stack.
161pub const OP_PUSHBYTES_67: u8 = 0x43;
162/// Push the next 68 bytes as an array onto the stack.
163pub const OP_PUSHBYTES_68: u8 = 0x44;
164/// Push the next 69 bytes as an array onto the stack.
165pub const OP_PUSHBYTES_69: u8 = 0x45;
166/// Push the next 70 bytes as an array onto the stack.
167pub const OP_PUSHBYTES_70: u8 = 0x46;
168/// Push the next 71 bytes as an array onto the stack.
169pub const OP_PUSHBYTES_71: u8 = 0x47;
170/// Push the next 72 bytes as an array onto the stack.
171pub const OP_PUSHBYTES_72: u8 = 0x48;
172/// Push the next 73 bytes as an array onto the stack.
173pub const OP_PUSHBYTES_73: u8 = 0x49;
174/// Push the next 74 bytes as an array onto the stack.
175pub const OP_PUSHBYTES_74: u8 = 0x4a;
176/// Push the next 75 bytes as an array onto the stack.
177pub const OP_PUSHBYTES_75: u8 = 0x4b;
178/// Read the next byte as N; push the next N bytes as an array onto the stack.
179pub const OP_PUSHDATA1: u8 = 0x4c;
180/// Read the next 2 bytes as N; push the next N bytes as an array onto the
181/// stack.
182pub const OP_PUSHDATA2: u8 = 0x4d;
183/// Read the next 4 bytes as N; push the next N bytes as an array onto the
184/// stack.
185pub const OP_PUSHDATA4: u8 = 0x4e;
186/// Push the array `0x81` onto the stack.
187pub const OP_PUSHNUM_NEG1: u8 = 0x4f;
188/// Synonym for OP_RETURN.
189pub const OP_RESERVED: u8 = 0x50;
190/// Push the array `0x01` onto the stack.
191///
192/// Also, a synonym for `OP_1` and `OP_TRUE`.
193pub const OP_PUSHNUM_1: u8 = 0x51;
194/// the array `0x02` onto the stack.
195pub const OP_PUSHNUM_2: u8 = 0x52;
196/// Push the array `0x03` onto the stack.
197pub const OP_PUSHNUM_3: u8 = 0x53;
198/// Push the array `0x04` onto the stack.
199pub const OP_PUSHNUM_4: u8 = 0x54;
200/// Push the array `0x05` onto the stack.
201pub const OP_PUSHNUM_5: u8 = 0x55;
202/// Push the array `0x06` onto the stack.
203pub const OP_PUSHNUM_6: u8 = 0x56;
204/// Push the array `0x07` onto the stack.
205pub const OP_PUSHNUM_7: u8 = 0x57;
206/// Push the array `0x08` onto the stack.
207pub const OP_PUSHNUM_8: u8 = 0x58;
208/// Push the array `0x09` onto the stack.
209pub const OP_PUSHNUM_9: u8 = 0x59;
210/// Push the array `0x0a` onto the stack.
211pub const OP_PUSHNUM_10: u8 = 0x5a;
212/// Push the array `0x0b` onto the stack.
213pub const OP_PUSHNUM_11: u8 = 0x5b;
214/// Push the array `0x0c` onto the stack.
215pub const OP_PUSHNUM_12: u8 = 0x5c;
216/// Push the array `0x0d` onto the stack.
217pub const OP_PUSHNUM_13: u8 = 0x5d;
218/// Push the array `0x0e` onto the stack.
219pub const OP_PUSHNUM_14: u8 = 0x5e;
220/// Push the array `0x0f` onto the stack.
221pub const OP_PUSHNUM_15: u8 = 0x5f;
222/// Push the array `0x10` onto the stack.
223pub const OP_PUSHNUM_16: u8 = 0x60;
224/// Does nothing.
225pub const OP_NOP: u8 = 0x61;
226/// Synonym for OP_RETURN.
227pub const OP_VER: u8 = 0x62;
228/// Pop and execute the next statements if a nonzero element was popped.
229pub const OP_IF: u8 = 0x63;
230/// Pop and execute the next statements if a zero element was popped.
231pub const OP_NOTIF: u8 = 0x64;
232/// Fail the script unconditionally, does not even need to be executed.
233pub const OP_VERIF: u8 = 0x65;
234/// Fail the script unconditionally, does not even need to be executed.
235pub const OP_VERNOTIF: u8 = 0x66;
236/// Execute statements if those after the previous OP_IF were not, and
237/// vice-versa. If there is no previous OP_IF, this acts as an OP_RETURN.
238pub const OP_ELSE: u8 = 0x67;
239/// Pop and execute the next statements if a zero element was popped.
240pub const OP_ENDIF: u8 = 0x68;
241/// If the top value is zero or the stack is empty, fail; otherwise, pop the
242/// stack.
243pub const OP_VERIFY: u8 = 0x69;
244/// Fail the script immediately. (Must be executed.).
245pub const OP_RETURN: u8 = 0x6a;
246/// Pop one element from the main stack onto the alt stack.
247pub const OP_TOALTSTACK: u8 = 0x6b;
248/// Pop one element from the alt stack onto the main stack.
249pub const OP_FROMALTSTACK: u8 = 0x6c;
250/// Drops the top two stack items.
251pub const OP_2DROP: u8 = 0x6d;
252/// Duplicates the top two stack items as AB -> ABAB.
253pub const OP_2DUP: u8 = 0x6e;
254/// Duplicates the two three stack items as ABC -> ABCABC.
255pub const OP_3DUP: u8 = 0x6f;
256/// Copies the two stack items of items two spaces back to the front, as xxAB ->
257/// ABxxAB.
258pub const OP_2OVER: u8 = 0x70;
259/// Moves the two stack items four spaces back to the front, as xxxxAB ->
260/// ABxxxx.
261pub const OP_2ROT: u8 = 0x71;
262/// Swaps the top two pairs, as ABCD -> CDAB.
263pub const OP_2SWAP: u8 = 0x72;
264/// Duplicate the top stack element unless it is zero.
265pub const OP_IFDUP: u8 = 0x73;
266/// Push the current number of stack items onto the stack.
267pub const OP_DEPTH: u8 = 0x74;
268/// Drops the top stack item.
269pub const OP_DROP: u8 = 0x75;
270/// Duplicates the top stack item.
271pub const OP_DUP: u8 = 0x76;
272/// Drops the second-to-top stack item.
273pub const OP_NIP: u8 = 0x77;
274/// Copies the second-to-top stack item, as xA -> AxA.
275pub const OP_OVER: u8 = 0x78;
276/// Pop the top stack element as N. Copy the Nth stack element to the top.
277pub const OP_PICK: u8 = 0x79;
278/// Pop the top stack element as N. Move the Nth stack element to the top.
279pub const OP_ROLL: u8 = 0x7a;
280/// Rotate the top three stack items, as [top next1 next2] -> [next2 top next1].
281pub const OP_ROT: u8 = 0x7b;
282/// Swap the top two stack items.
283pub const OP_SWAP: u8 = 0x7c;
284/// Copy the top stack item to before the second item, as [top next] -> [top
285/// next top].
286pub const OP_TUCK: u8 = 0x7d;
287
288/// Fail the script unconditionally, does not even need to be executed.
289pub const OP_CAT: u8 = 0x7e;
290/// Fail the script unconditionally, does not even need to be executed.
291pub const OP_SUBSTR: u8 = 0x7f;
292/// Fail the script unconditionally, does not even need to be executed.
293pub const OP_LEFT: u8 = 0x80;
294/// Fail the script unconditionally, does not even need to be executed.
295pub const OP_RIGHT: u8 = 0x81;
296
297/// Pushes the length of the top stack item onto the stack.
298pub const OP_SIZE: u8 = 0x82;
299/// Fail the script unconditionally, does not even need to be executed.
300pub const OP_INVERT: u8 = 0x83;
301/// Fail the script unconditionally, does not even need to be executed.
302pub const OP_AND: u8 = 0x84;
303/// Fail the script unconditionally, does not even need to be executed.
304pub const OP_OR: u8 = 0x85;
305/// Fail the script unconditionally, does not even need to be executed.
306pub const OP_XOR: u8 = 0x86;
307/// Pushes 1 if the inputs are exactly equal, 0 otherwise.
308pub const OP_EQUAL: u8 = 0x87;
309/// Returns success if the inputs are exactly equal, failure otherwise.
310pub const OP_EQUALVERIFY: u8 = 0x88;
311/// Synonym for OP_RETURN.
312pub const OP_RESERVED1: u8 = 0x89;
313/// Synonym for OP_RETURN.
314pub const OP_RESERVED2: u8 = 0x8a;
315/// Increment the top stack element in place.
316pub const OP_1ADD: u8 = 0x8b;
317/// Decrement the top stack element in place.
318pub const OP_1SUB: u8 = 0x8c;
319/// Fail the script unconditionally, does not even need to be executed.
320pub const OP_2MUL: u8 = 0x8d;
321/// Fail the script unconditionally, does not even need to be executed.
322pub const OP_2DIV: u8 = 0x8e;
323/// Multiply the top stack item by -1 in place.
324pub const OP_NEGATE: u8 = 0x8f;
325/// Absolute value the top stack item in place.
326pub const OP_ABS: u8 = 0x90;
327/// Map 0 to 1 and everything else to 0, in place.
328pub const OP_NOT: u8 = 0x91;
329/// Map 0 to 0 and everything else to 1, in place.
330pub const OP_0NOTEQUAL: u8 = 0x92;
331/// Pop two stack items and push their sum.
332pub const OP_ADD: u8 = 0x93;
333/// Pop two stack items and push the second minus the top.
334pub const OP_SUB: u8 = 0x94;
335/// Fail the script unconditionally, does not even need to be executed.
336pub const OP_MUL: u8 = 0x95;
337/// Fail the script unconditionally, does not even need to be executed.
338pub const OP_DIV: u8 = 0x96;
339/// Fail the script unconditionally, does not even need to be executed.
340pub const OP_MOD: u8 = 0x97;
341/// Fail the script unconditionally, does not even need to be executed.
342pub const OP_LSHIFT: u8 = 0x98;
343/// Fail the script unconditionally, does not even need to be executed.
344pub const OP_RSHIFT: u8 = 0x99;
345/// Pop the top two stack items and push 1 if both are nonzero, else push 0.
346pub const OP_BOOLAND: u8 = 0x9a;
347/// Pop the top two stack items and push 1 if either is nonzero, else push 0.
348pub const OP_BOOLOR: u8 = 0x9b;
349/// Pop the top two stack items and push 1 if both are numerically equal, else
350/// push 0.
351pub const OP_NUMEQUAL: u8 = 0x9c;
352/// Pop the top two stack items and return success if both are numerically
353/// equal, else return failure.
354pub const OP_NUMEQUALVERIFY: u8 = 0x9d;
355/// Pop the top two stack items and push 0 if both are numerically equal, else
356/// push 1.
357pub const OP_NUMNOTEQUAL: u8 = 0x9e;
358/// Pop the top two items; push 1 if the second is less than the top, 0
359/// otherwise.
360pub const OP_LESSTHAN: u8 = 0x9f;
361/// Pop the top two items; push 1 if the second is greater than the top, 0
362/// otherwise.
363pub const OP_GREATERTHAN: u8 = 0xa0;
364/// Pop the top two items; push 1 if the second is <= the top, 0 otherwise.
365pub const OP_LESSTHANOREQUAL: u8 = 0xa1;
366/// Pop the top two items; push 1 if the second is >= the top, 0 otherwise.
367pub const OP_GREATERTHANOREQUAL: u8 = 0xa2;
368/// Pop the top two items; push the smaller.
369pub const OP_MIN: u8 = 0xa3;
370/// Pop the top two items; push the larger.
371pub const OP_MAX: u8 = 0xa4;
372/// Pop the top three items; if the top is >= the second and < the third, push
373/// 1, otherwise push 0.
374pub const OP_WITHIN: u8 = 0xa5;
375/// Pop the top stack item and push its RIPEMD160 hash.
376pub const OP_RIPEMD160: u8 = 0xa6;
377/// Pop the top stack item and push its SHA1 hash.
378pub const OP_SHA1: u8 = 0xa7;
379/// Pop the top stack item and push its SHA256 hash.
380pub const OP_SHA256: u8 = 0xa8;
381/// Pop the top stack item and push its RIPEMD(SHA256) hash.
382pub const OP_HASH160: u8 = 0xa9;
383/// Pop the top stack item and push its SHA256(SHA256) hash.
384pub const OP_HASH256: u8 = 0xaa;
385/// Ignore this and everything preceding when deciding what to sign when
386/// signature-checking.
387pub const OP_CODESEPARATOR: u8 = 0xab;
388/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> pushing 1/0 for success/failure.
389pub const OP_CHECKSIG: u8 = 0xac;
390/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> returning success/failure.
391pub const OP_CHECKSIGVERIFY: u8 = 0xad;
392/// Pop N, N pubkeys, M, M signatures, a dummy (due to bug in reference code),
393/// and verify that all M signatures are valid. Push 1 for 'all valid', 0
394/// otherwise.
395pub const OP_CHECKMULTISIG: u8 = 0xae;
396/// Like the above but return success/failure.
397pub const OP_CHECKMULTISIGVERIFY: u8 = 0xaf;
398/// Does nothing.
399pub const OP_NOP1: u8 = 0xb0;
400/// <https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki>
401pub const OP_CLTV: u8 = 0xb1;
402/// <https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki>
403pub const OP_CSV: u8 = 0xb2;
404/// Does nothing.
405pub const OP_NOP4: u8 = 0xb3;
406/// Does nothing.
407pub const OP_NOP5: u8 = 0xb4;
408/// Does nothing.
409pub const OP_NOP6: u8 = 0xb5;
410/// Does nothing.
411pub const OP_NOP7: u8 = 0xb6;
412/// Does nothing.
413pub const OP_NOP8: u8 = 0xb7;
414/// Does nothing.
415pub const OP_NOP9: u8 = 0xb8;
416/// Does nothing.
417pub const OP_NOP10: u8 = 0xb9;
418// Every other opcode acts as OP_RETURN
419/// OP_CHECKSIGADD post tapscript.
420pub const OP_CHECKSIGADD: u8 = 0xba;
421/// Synonym for OP_RETURN.
422pub const OP_RETURN_187: u8 = 0xbb;
423/// Synonym for OP_RETURN.
424pub const OP_RETURN_188: u8 = 0xbc;
425/// Synonym for OP_RETURN.
426pub const OP_RETURN_189: u8 = 0xbd;
427/// Synonym for OP_RETURN.
428pub const OP_RETURN_190: u8 = 0xbe;
429/// Synonym for OP_RETURN.
430pub const OP_RETURN_191: u8 = 0xbf;
431/// Synonym for OP_RETURN.
432pub const OP_RETURN_192: u8 = 0xc0;
433/// Synonym for OP_RETURN.
434pub const OP_RETURN_193: u8 = 0xc1;
435/// Synonym for OP_RETURN.
436pub const OP_RETURN_194: u8 = 0xc2;
437/// Synonym for OP_RETURN.
438pub const OP_RETURN_195: u8 = 0xc3;
439/// Synonym for OP_RETURN.
440pub const OP_RETURN_196: u8 = 0xc4;
441/// Synonym for OP_RETURN.
442pub const OP_RETURN_197: u8 = 0xc5;
443/// Synonym for OP_RETURN.
444pub const OP_RETURN_198: u8 = 0xc6;
445/// Synonym for OP_RETURN.
446pub const OP_RETURN_199: u8 = 0xc7;
447/// Synonym for OP_RETURN.
448pub const OP_RETURN_200: u8 = 0xc8;
449/// Synonym for OP_RETURN.
450pub const OP_RETURN_201: u8 = 0xc9;
451/// Synonym for OP_RETURN.
452pub const OP_RETURN_202: u8 = 0xca;
453/// Synonym for OP_RETURN.
454pub const OP_RETURN_203: u8 = 0xcb;
455/// Synonym for OP_RETURN.
456pub const OP_RETURN_204: u8 = 0xcc;
457/// Synonym for OP_RETURN.
458pub const OP_RETURN_205: u8 = 0xcd;
459/// Synonym for OP_RETURN.
460pub const OP_RETURN_206: u8 = 0xce;
461/// Synonym for OP_RETURN.
462pub const OP_RETURN_207: u8 = 0xcf;
463/// Synonym for OP_RETURN.
464pub const OP_RETURN_208: u8 = 0xd0;
465/// Synonym for OP_RETURN.
466pub const OP_RETURN_209: u8 = 0xd1;
467/// Synonym for OP_RETURN.
468pub const OP_RETURN_210: u8 = 0xd2;
469/// Synonym for OP_RETURN.
470pub const OP_RETURN_211: u8 = 0xd3;
471/// Synonym for OP_RETURN.
472pub const OP_RETURN_212: u8 = 0xd4;
473/// Synonym for OP_RETURN.
474pub const OP_RETURN_213: u8 = 0xd5;
475/// Synonym for OP_RETURN.
476pub const OP_RETURN_214: u8 = 0xd6;
477/// Synonym for OP_RETURN.
478pub const OP_RETURN_215: u8 = 0xd7;
479/// Synonym for OP_RETURN.
480pub const OP_RETURN_216: u8 = 0xd8;
481/// Synonym for OP_RETURN.
482pub const OP_RETURN_217: u8 = 0xd9;
483/// Synonym for OP_RETURN.
484pub const OP_RETURN_218: u8 = 0xda;
485/// Synonym for OP_RETURN.
486pub const OP_RETURN_219: u8 = 0xdb;
487/// Synonym for OP_RETURN.
488pub const OP_RETURN_220: u8 = 0xdc;
489/// Synonym for OP_RETURN.
490pub const OP_RETURN_221: u8 = 0xdd;
491/// Synonym for OP_RETURN.
492pub const OP_RETURN_222: u8 = 0xde;
493/// Synonym for OP_RETURN.
494pub const OP_RETURN_223: u8 = 0xdf;
495/// Synonym for OP_RETURN.
496pub const OP_RETURN_224: u8 = 0xe0;
497/// Synonym for OP_RETURN.
498pub const OP_RETURN_225: u8 = 0xe1;
499/// Synonym for OP_RETURN.
500pub const OP_RETURN_226: u8 = 0xe2;
501/// Synonym for OP_RETURN.
502pub const OP_RETURN_227: u8 = 0xe3;
503/// Synonym for OP_RETURN.
504pub const OP_RETURN_228: u8 = 0xe4;
505/// Synonym for OP_RETURN.
506pub const OP_RETURN_229: u8 = 0xe5;
507/// Synonym for OP_RETURN.
508pub const OP_RETURN_230: u8 = 0xe6;
509/// Synonym for OP_RETURN.
510pub const OP_RETURN_231: u8 = 0xe7;
511/// Synonym for OP_RETURN.
512pub const OP_RETURN_232: u8 = 0xe8;
513/// Synonym for OP_RETURN.
514pub const OP_RETURN_233: u8 = 0xe9;
515/// Synonym for OP_RETURN.
516pub const OP_RETURN_234: u8 = 0xea;
517/// Synonym for OP_RETURN.
518pub const OP_RETURN_235: u8 = 0xeb;
519/// Synonym for OP_RETURN.
520pub const OP_RETURN_236: u8 = 0xec;
521/// Synonym for OP_RETURN.
522pub const OP_RETURN_237: u8 = 0xed;
523/// Synonym for OP_RETURN.
524pub const OP_RETURN_238: u8 = 0xee;
525/// Synonym for OP_RETURN.
526pub const OP_RETURN_239: u8 = 0xef;
527/// Synonym for OP_RETURN.
528pub const OP_RETURN_240: u8 = 0xf0;
529/// Synonym for OP_RETURN.
530pub const OP_RETURN_241: u8 = 0xf1;
531/// Synonym for OP_RETURN.
532pub const OP_RETURN_242: u8 = 0xf2;
533/// Synonym for OP_RETURN.
534pub const OP_RETURN_243: u8 = 0xf3;
535/// Synonym for OP_RETURN.
536pub const OP_RETURN_244: u8 = 0xf4;
537/// Synonym for OP_RETURN.
538pub const OP_RETURN_245: u8 = 0xf5;
539/// Synonym for OP_RETURN.
540pub const OP_RETURN_246: u8 = 0xf6;
541/// Synonym for OP_RETURN.
542pub const OP_RETURN_247: u8 = 0xf7;
543/// Synonym for OP_RETURN.
544pub const OP_RETURN_248: u8 = 0xf8;
545/// Synonym for OP_RETURN.
546pub const OP_RETURN_249: u8 = 0xf9;
547/// Synonym for OP_RETURN.
548pub const OP_RETURN_250: u8 = 0xfa;
549/// Synonym for OP_RETURN.
550pub const OP_RETURN_251: u8 = 0xfb;
551/// Synonym for OP_RETURN.
552pub const OP_RETURN_252: u8 = 0xfc;
553/// Synonym for OP_RETURN.
554pub const OP_RETURN_253: u8 = 0xfd;
555/// Synonym for OP_RETURN.
556pub const OP_RETURN_254: u8 = 0xfe;
557/// Synonym for OP_RETURN.
558pub const OP_INVALIDOPCODE: u8 = 0xff;
559
560#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Display)]
561#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]
562#[strict_type(lib = LIB_NAME_BITCOIN, tags = repr, into_u8, try_from_u8)]
563#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
564#[non_exhaustive]
565#[repr(u8)]
566pub enum OpCode {
567 /// Push an empty array onto the stack.
568 ///
569 /// Also, a synonym for `OP_0` and `OP_FALSE`.
570 #[display("OP_PUSH_BYTES0")]
571 PushBytes0 = OP_PUSHBYTES_0,
572 /// Push the next byte as an array onto the stack.
573 #[display("OP_PUSH_BYTES1")]
574 PushBytes1 = OP_PUSHBYTES_1,
575 /// Push the next 2 bytes as an array onto the stack.
576 #[display("OP_PUSH_BYTES2")]
577 PushBytes2 = OP_PUSHBYTES_2,
578 /// Push the next 3 bytes as an array onto the stack.
579 #[display("OP_PUSH_BYTES3")]
580 PushBytes3 = OP_PUSHBYTES_3,
581 /// Push the next 4 bytes as an array onto the stack.
582 #[display("OP_PUSH_BYTES4")]
583 PushBytes4 = OP_PUSHBYTES_4,
584 /// Push the next 5 bytes as an array onto the stack.
585 #[display("OP_PUSH_BYTES5")]
586 PushBytes5 = OP_PUSHBYTES_5,
587 /// Push the next 6 bytes as an array onto the stack.
588 #[display("OP_PUSH_BYTES6")]
589 PushBytes6 = OP_PUSHBYTES_6,
590 /// Push the next 7 bytes as an array onto the stack.
591 #[display("OP_PUSH_BYTES7")]
592 PushBytes7 = OP_PUSHBYTES_7,
593 /// Push the next 8 bytes as an array onto the stack.
594 #[display("OP_PUSH_BYTES8")]
595 PushBytes8 = OP_PUSHBYTES_8,
596 /// Push the next 9 bytes as an array onto the stack.
597 #[display("OP_PUSH_BYTES9")]
598 PushBytes9 = OP_PUSHBYTES_9,
599 /// Push the next 10 bytes as an array onto the stack.
600 #[display("OP_PUSH_BYTES10")]
601 PushBytes10 = OP_PUSHBYTES_10,
602 /// Push the next 11 bytes as an array onto the stack.
603 #[display("OP_PUSH_BYTES11")]
604 PushBytes11 = OP_PUSHBYTES_11,
605 /// Push the next 12 bytes as an array onto the stack.
606 #[display("OP_PUSH_BYTES12")]
607 PushBytes12 = OP_PUSHBYTES_12,
608 /// Push the next 13 bytes as an array onto the stack.
609 #[display("OP_PUSH_BYTES13")]
610 PushBytes13 = OP_PUSHBYTES_13,
611 /// Push the next 14 bytes as an array onto the stack.
612 #[display("OP_PUSH_BYTES14")]
613 PushBytes14 = OP_PUSHBYTES_14,
614 /// Push the next 15 bytes as an array onto the stack.
615 #[display("OP_PUSH_BYTES15")]
616 PushBytes15 = OP_PUSHBYTES_15,
617 /// Push the next 16 bytes as an array onto the stack.
618 #[display("OP_PUSH_BYTES16")]
619 PushBytes16 = OP_PUSHBYTES_16,
620 /// Push the next 17 bytes as an array onto the stack.
621 #[display("OP_PUSH_BYTES17")]
622 PushBytes17 = OP_PUSHBYTES_17,
623 /// Push the next 18 bytes as an array onto the stack.
624 #[display("OP_PUSH_BYTES18")]
625 PushBytes18 = OP_PUSHBYTES_18,
626 /// Push the next 19 bytes as an array onto the stack.
627 #[display("OP_PUSH_BYTES19")]
628 PushBytes19 = OP_PUSHBYTES_19,
629 /// Push the next 20 bytes as an array onto the stack.
630 #[display("OP_PUSH_BYTES20")]
631 PushBytes20 = OP_PUSHBYTES_20,
632 /// Push the next 21 bytes as an array onto the stack.
633 #[display("OP_PUSH_BYTES21")]
634 PushBytes21 = OP_PUSHBYTES_21,
635 /// Push the next 22 bytes as an array onto the stack.
636 #[display("OP_PUSH_BYTES22")]
637 PushBytes22 = OP_PUSHBYTES_22,
638 /// Push the next 23 bytes as an array onto the stack.
639 #[display("OP_PUSH_BYTES23")]
640 PushBytes23 = OP_PUSHBYTES_23,
641 /// Push the next 24 bytes as an array onto the stack.
642 #[display("OP_PUSH_BYTES24")]
643 PushBytes24 = OP_PUSHBYTES_24,
644 /// Push the next 25 bytes as an array onto the stack.
645 #[display("OP_PUSH_BYTES25")]
646 PushBytes25 = OP_PUSHBYTES_25,
647 /// Push the next 26 bytes as an array onto the stack.
648 #[display("OP_PUSH_BYTES26")]
649 PushBytes26 = OP_PUSHBYTES_26,
650 /// Push the next 27 bytes as an array onto the stack.
651 #[display("OP_PUSH_BYTES27")]
652 PushBytes27 = OP_PUSHBYTES_27,
653 /// Push the next 28 bytes as an array onto the stack.
654 #[display("OP_PUSH_BYTES28")]
655 PushBytes28 = OP_PUSHBYTES_28,
656 /// Push the next 29 bytes as an array onto the stack.
657 #[display("OP_PUSH_BYTES29")]
658 PushBytes29 = OP_PUSHBYTES_29,
659 /// Push the next 30 bytes as an array onto the stack.
660 #[display("OP_PUSH_BYTES30")]
661 PushBytes30 = OP_PUSHBYTES_30,
662 /// Push the next 31 byte as an array onto the stack.
663 #[display("OP_PUSH_BYTES31")]
664 PushBytes31 = OP_PUSHBYTES_31,
665 /// Push the next 32 bytes as an array onto the stack.
666 #[display("OP_PUSH_BYTES32")]
667 PushBytes32 = OP_PUSHBYTES_32,
668 /// Push the next 33 bytes as an array onto the stack.
669 #[display("OP_PUSH_BYTES33")]
670 PushBytes33 = OP_PUSHBYTES_33,
671 /// Push the next 34 bytes as an array onto the stack.
672 #[display("OP_PUSH_BYTES34")]
673 PushBytes34 = OP_PUSHBYTES_34,
674 /// Push the next 35 bytes as an array onto the stack.
675 #[display("OP_PUSH_BYTES35")]
676 PushBytes35 = OP_PUSHBYTES_35,
677 /// Push the next 36 bytes as an array onto the stack.
678 #[display("OP_PUSH_BYTES36")]
679 PushBytes36 = OP_PUSHBYTES_36,
680 /// Push the next 37 bytes as an array onto the stack.
681 #[display("OP_PUSH_BYTES37")]
682 PushBytes37 = OP_PUSHBYTES_37,
683 /// Push the next 38 bytes as an array onto the stack.
684 #[display("OP_PUSH_BYTES38")]
685 PushBytes38 = OP_PUSHBYTES_38,
686 /// Push the next 39 bytes as an array onto the stack.
687 #[display("OP_PUSH_BYTES39")]
688 PushBytes39 = OP_PUSHBYTES_39,
689 /// Push the next 40 bytes as an array onto the stack.
690 #[display("OP_PUSH_BYTES40")]
691 PushBytes40 = OP_PUSHBYTES_40,
692 /// Push the next 41 bytes as an array onto the stack.
693 #[display("OP_PUSH_BYTES41")]
694 PushBytes41 = OP_PUSHBYTES_41,
695 /// Push the next 42 bytes as an array onto the stack.
696 #[display("OP_PUSH_BYTES42")]
697 PushBytes42 = OP_PUSHBYTES_42,
698 /// Push the next 43 bytes as an array onto the stack.
699 #[display("OP_PUSH_BYTES43")]
700 PushBytes43 = OP_PUSHBYTES_43,
701 /// Push the next 44 bytes as an array onto the stack.
702 #[display("OP_PUSH_BYTES44")]
703 PushBytes44 = OP_PUSHBYTES_44,
704 /// Push the next 45 bytes as an array onto the stack.
705 #[display("OP_PUSH_BYTES45")]
706 PushBytes45 = OP_PUSHBYTES_45,
707 /// Push the next 46 bytes as an array onto the stack.
708 #[display("OP_PUSH_BYTES46")]
709 PushBytes46 = OP_PUSHBYTES_46,
710 /// Push the next 47 bytes as an array onto the stack.
711 #[display("OP_PUSH_BYTES47")]
712 PushBytes47 = OP_PUSHBYTES_47,
713 /// Push the next 48 bytes as an array onto the stack.
714 #[display("OP_PUSH_BYTES48")]
715 PushBytes48 = OP_PUSHBYTES_48,
716 /// Push the next 49 bytes as an array onto the stack.
717 #[display("OP_PUSH_BYTES49")]
718 PushBytes49 = OP_PUSHBYTES_49,
719 /// Push the next 50 bytes as an array onto the stack.
720 #[display("OP_PUSH_BYTES50")]
721 PushBytes50 = OP_PUSHBYTES_50,
722 /// Push the next 51 bytes as an array onto the stack.
723 #[display("OP_PUSH_BYTES51")]
724 PushBytes51 = OP_PUSHBYTES_51,
725 /// Push the next 52 bytes as an array onto the stack.
726 #[display("OP_PUSH_BYTES52")]
727 PushBytes52 = OP_PUSHBYTES_52,
728 /// Push the next 53 bytes as an array onto the stack.
729 #[display("OP_PUSH_BYTES53")]
730 PushBytes53 = OP_PUSHBYTES_53,
731 /// Push the next 54 bytes as an array onto the stack.
732 #[display("OP_PUSH_BYTES54")]
733 PushBytes54 = OP_PUSHBYTES_54,
734 /// Push the next 55 bytes as an array onto the stack.
735 #[display("OP_PUSH_BYTES55")]
736 PushBytes55 = OP_PUSHBYTES_55,
737 /// Push the next 56 bytes as an array onto the stack.
738 #[display("OP_PUSH_BYTES56")]
739 PushBytes56 = OP_PUSHBYTES_56,
740 /// Push the next 57 bytes as an array onto the stack.
741 #[display("OP_PUSH_BYTES57")]
742 PushBytes57 = OP_PUSHBYTES_57,
743 /// Push the next 58 bytes as an array onto the stack.
744 #[display("OP_PUSH_BYTES58")]
745 PushBytes58 = OP_PUSHBYTES_58,
746 /// Push the next 59 bytes as an array onto the stack.
747 #[display("OP_PUSH_BYTES59")]
748 PushBytes59 = OP_PUSHBYTES_59,
749 /// Push the next 60 bytes as an array onto the stack.
750 #[display("OP_PUSH_BYTES60")]
751 PushBytes60 = OP_PUSHBYTES_60,
752 /// Push the next 61 bytes as an array onto the stack.
753 #[display("OP_PUSH_BYTES61")]
754 PushBytes61 = OP_PUSHBYTES_61,
755 /// Push the next 62 bytes as an array onto the stack.
756 #[display("OP_PUSH_BYTES62")]
757 PushBytes62 = OP_PUSHBYTES_62,
758 /// Push the next 63 bytes as an array onto the stack.
759 #[display("OP_PUSH_BYTES63")]
760 PushBytes63 = OP_PUSHBYTES_63,
761 /// Push the next 64 bytes as an array onto the stack.
762 #[display("OP_PUSH_BYTES64")]
763 PushBytes64 = OP_PUSHBYTES_64,
764 /// Push the next 65 bytes as an array onto the stack.
765 #[display("OP_PUSH_BYTES65")]
766 PushBytes65 = OP_PUSHBYTES_65,
767 /// Push the next 66 bytes as an array onto the stack.
768 #[display("OP_PUSH_BYTES66")]
769 PushBytes66 = OP_PUSHBYTES_66,
770 /// Push the next 67 bytes as an array onto the stack.
771 #[display("OP_PUSH_BYTES67")]
772 PushBytes67 = OP_PUSHBYTES_67,
773 /// Push the next 68 bytes as an array onto the stack.
774 #[display("OP_PUSH_BYTES68")]
775 PushBytes68 = OP_PUSHBYTES_68,
776 /// Push the next 69 bytes as an array onto the stack.
777 #[display("OP_PUSH_BYTES69")]
778 PushBytes69 = OP_PUSHBYTES_69,
779 /// Push the next 70 bytes as an array onto the stack.
780 #[display("OP_PUSH_BYTES70")]
781 PushBytes70 = OP_PUSHBYTES_70,
782 /// Push the next 71 bytes as an array onto the stack.
783 #[display("OP_PUSH_BYTES71")]
784 PushBytes71 = OP_PUSHBYTES_71,
785 /// Push the next 72 bytes as an array onto the stack.
786 #[display("OP_PUSH_BYTES72")]
787 PushBytes72 = OP_PUSHBYTES_72,
788 /// Push the next 73 bytes as an array onto the stack.
789 #[display("OP_PUSH_BYTES73")]
790 PushBytes73 = OP_PUSHBYTES_73,
791 /// Push the next 74 bytes as an array onto the stack.
792 #[display("OP_PUSH_BYTES74")]
793 PushByte764 = OP_PUSHBYTES_74,
794 /// Push the next 75 bytes as an array onto the stack.
795 #[display("OP_PUSH_BYTES75")]
796 PushBytes75 = OP_PUSHBYTES_75,
797
798 /// Read the next byte as N; push the next N bytes as an array onto the
799 /// stack.
800 #[display("OP_PUSH_DATA1")]
801 PushData1 = OP_PUSHDATA1,
802 /// Read the next 2 bytes as N; push the next N bytes as an array onto the
803 /// stack.
804 #[display("OP_PUSH_DATA2")]
805 PushData2 = OP_PUSHDATA2,
806 /// Read the next 4 bytes as N; push the next N bytes as an array onto the
807 /// stack.
808 #[display("OP_PUSH_DATA3")]
809 PushData4 = OP_PUSHDATA4,
810
811 /// Push the array `0x81` onto the stack.
812 #[display("OP_PUSHNUM_NEG1")]
813 PushNumNeg1 = OP_PUSHNUM_NEG1,
814
815 /// Synonym for OP_RETURN.
816 #[display("OP_RESERVED")]
817 Reserved = OP_RESERVED,
818
819 /// Push the array `0x01` onto the stack.
820 ///
821 /// Also, a synonym for `OP_1` and `OP_TRUE`.
822 #[display("OP_PUSHNUM_1")]
823 PushNum1 = OP_PUSHNUM_1,
824 /// Push the array `0x02` onto the stack.
825 #[display("OP_PUSHNUM_2")]
826 PushNum2 = OP_PUSHNUM_2,
827 /// Push the array `0x03` onto the stack.
828 #[display("OP_PUSHNUM_3")]
829 PushNum3 = OP_PUSHNUM_3,
830 /// Push the array `0x04` onto the stack.
831 #[display("OP_PUSHNUM_4")]
832 PushNum4 = OP_PUSHNUM_4,
833 /// Push the array `0x05` onto the stack.
834 #[display("OP_PUSHNUM_5")]
835 PushNum5 = OP_PUSHNUM_5,
836 /// Push the array `0x06` onto the stack.
837 #[display("OP_PUSHNUM_6")]
838 PushNum6 = OP_PUSHNUM_6,
839 /// Push the array `0x07` onto the stack.
840 #[display("OP_PUSHNUM_7")]
841 PushNum7 = OP_PUSHNUM_7,
842 /// Push the array `0x08` onto the stack.
843 #[display("OP_PUSHNUM_8")]
844 PushNum8 = OP_PUSHNUM_8,
845 /// Push the array `0x09` onto the stack.
846 #[display("OP_PUSHNUM_9")]
847 PushNum9 = OP_PUSHNUM_9,
848 /// Push the array `0x0A` onto the stack.
849 #[display("OP_PUSHNUM_10")]
850 PushNum10 = OP_PUSHNUM_10,
851 /// Push the array `0x0B` onto the stack.
852 #[display("OP_PUSHNUM_11")]
853 PushNum11 = OP_PUSHNUM_11,
854 /// Push the array `0x0C` onto the stack.
855 #[display("OP_PUSHNUM_12")]
856 PushNum12 = OP_PUSHNUM_12,
857 /// Push the array `0x0D` onto the stack.
858 #[display("OP_PUSHNUM_13")]
859 PushNum13 = OP_PUSHNUM_13,
860 /// Push the array `0x0E` onto the stack.
861 #[display("OP_PUSHNUM_14")]
862 PushNum14 = OP_PUSHNUM_14,
863 /// Push the array `0x0F` onto the stack.
864 #[display("OP_PUSHNUM_15")]
865 PushNum15 = OP_PUSHNUM_15,
866 /// Push the array `0x10` onto the stack.
867 #[display("OP_PUSHNUM_16")]
868 PushNum16 = OP_PUSHNUM_16,
869
870 /// Does nothing.
871 #[display("OP_NOP")]
872 Nop = OP_NOP,
873
874 /// Synonym for OP_RETURN.
875 #[display("OP_VER")]
876 Ver = OP_VER,
877
878 /// Pop and execute the next statements if a nonzero element was popped.
879 #[display("OP_IF")]
880 If = OP_IF,
881 /// Pop and execute the next statements if a zero element was popped.
882 #[display("OP_NOTIF")]
883 NotIf = OP_NOTIF,
884 /// Fail the script unconditionally, does not even need to be executed.
885 #[display("OP_VERIF")]
886 VerIf = OP_VERIF,
887 /// Fail the script unconditionally, does not even need to be executed.
888 #[display("OP_VERNOTIF")]
889 VerNotIf = OP_VERNOTIF,
890 /// Execute statements if those after the previous OP_IF were not, and
891 /// vice versa. If there is no previous OP_IF, this acts as an OP_RETURN.
892 #[display("OP_ELSE")]
893 Else = OP_ELSE,
894 /// Pop and execute the next statements if a zero element was popped.
895 #[display("OP_ENDIF")]
896 EndIf = OP_ENDIF,
897 /// If the top value is zero or the stack is empty, fail; otherwise, pop the
898 /// stack.
899 #[display("OP_VERIFY")]
900 Verify = OP_VERIFY,
901
902 /// Fail the script immediately.
903 #[display("OP_RETURN")]
904 #[strict_type(dumb)]
905 Return = OP_RETURN,
906
907 #[display("OP_TOALTSTACK")]
908 ToAltStack = OP_TOALTSTACK,
909 /// Pop one element from the alt stack onto the main stack.
910 #[display("OP_FROMALTSTACK")]
911 FromAltStack = OP_FROMALTSTACK,
912 /// Drops the top two stack items.
913 #[display("OP_2DROP")]
914 Drop2 = OP_2DROP,
915 /// Duplicates the top two stack items as AB -> ABAB.
916 #[display("OP_2DUP")]
917 Dup2 = OP_2DUP,
918 /// Duplicates the two three stack items as ABC -> ABCABC.
919 #[display("OP_3DUP")]
920 Dup3 = OP_3DUP,
921 /// Copies the two stack items of items two spaces back to the front, as xxAB ->
922 /// ABxxAB.
923 #[display("OP_2OVER")]
924 Over2 = OP_2OVER,
925 /// Moves the two stack items four spaces back to the front, as xxxxAB ->
926 /// ABxxxx.
927 #[display("OP_2ROT")]
928 Rot2 = OP_2ROT,
929 /// Swaps the top two pairs, as ABCD -> CDAB.
930 #[display("OP_2SWAP")]
931 Swap2 = OP_2SWAP,
932 /// Duplicate the top stack element unless it is zero.
933 #[display("OP_IFDUP")]
934 IfDup = OP_IFDUP,
935 /// Push the current number of stack items onto the stack.
936 #[display("OP_DEPTH")]
937 Depth = OP_DEPTH,
938 /// Drops the top stack item.
939 #[display("OP_DROP")]
940 Drop = OP_DROP,
941 /// Duplicates the top stack item.
942 #[display("OP_DUP")]
943 Dup = OP_DUP,
944 /// Drops the second-to-top stack item.
945 #[display("OP_NIP")]
946 Nip = OP_NIP,
947 /// Copies the second-to-top stack item, as xA -> AxA.
948 #[display("OP_OVER")]
949 Over = OP_OVER,
950 /// Pop the top stack element as N. Copy the Nth stack element to the top.
951 #[display("OP_PICK")]
952 Pick = OP_PICK,
953 /// Pop the top stack element as N. Move the Nth stack element to the top.
954 #[display("OP_ROLL")]
955 Roll = OP_ROLL,
956 /// Rotate the top three stack items, as [top next1 next2] -> [next2 top next1].
957 #[display("OP_ROT")]
958 Rot = OP_ROT,
959 /// Swap the top two stack items.
960 #[display("OP_SWAP")]
961 Swap = OP_SWAP,
962 /// Copy the top stack item to before the second item, as [top next] -> [top
963 /// next top].
964 #[display("OP_TUCK")]
965 Tuck = OP_TUCK,
966 /// Fail the script unconditionally, does not even need to be executed.
967 #[display("OP_CAT")]
968 Cat = OP_CAT,
969 /// Fail the script unconditionally, does not even need to be executed.
970 #[display("OP_SUBSTR")]
971 SubStr = OP_SUBSTR,
972 /// Fail the script unconditionally, does not even need to be executed.
973 #[display("OP_LEFT")]
974 Left = OP_LEFT,
975 /// Fail the script unconditionally, does not even need to be executed.
976 #[display("OP_RIGHT")]
977 Right = OP_RIGHT,
978 /// Pushes the length of the top stack item onto the stack.
979 #[display("OP_SIZE")]
980 Size = OP_SIZE,
981 /// Fail the script unconditionally, does not even need to be executed.
982 #[display("OP_INVERT")]
983 Invert = OP_INVERT,
984 /// Fail the script unconditionally, does not even need to be executed.
985 #[display("OP_AND")]
986 And = OP_AND,
987 /// Fail the script unconditionally, does not even need to be executed.
988 #[display("OP_OR")]
989 Or = OP_OR,
990 /// Fail the script unconditionally, does not even need to be executed.
991 #[display("OP_XOR")]
992 Xor = OP_XOR,
993
994 /// Pushes 1 if the inputs are exactly equal, 0 otherwise.
995 #[display("OP_EQUAL")]
996 Equal = OP_EQUAL,
997 /// Returns success if the inputs are exactly equal, failure otherwise.
998 #[display("OP_EQUALVERIFY")]
999 EqualVerify = OP_EQUALVERIFY,
1000
1001 /// Synonym for OP_RETURN.
1002 #[display("OP_RESERVED1")]
1003 Reserved1 = OP_RESERVED1,
1004 /// Synonym for OP_RETURN.
1005 #[display("OP_RESERVED2")]
1006 Reserved2 = OP_RESERVED2,
1007
1008 /// Increment the top stack element in place.
1009 #[display("OP_1ADD")]
1010 Add1 = OP_1ADD,
1011 /// Decrement the top stack element in place.
1012 #[display("OP_1SUB")]
1013 Sub1 = OP_1SUB,
1014 /// Fail the script unconditionally, does not even need to be executed.
1015 #[display("OP_2MUL")]
1016 Mul2 = OP_2MUL,
1017 /// Fail the script unconditionally, does not even need to be executed.
1018 #[display("OP_2DIV")]
1019 Div2 = OP_2DIV,
1020 /// Multiply the top stack item by -1 in place.
1021 #[display("OP_NEGATE")]
1022 Negate = OP_NEGATE,
1023 /// Absolute value the top stack item in place.
1024 #[display("OP_ABS")]
1025 Abs = OP_ABS,
1026 /// Map 0 to 1 and everything else to 0, in place.
1027 #[display("OP_NOT")]
1028 Not = OP_NOT,
1029 /// Map 0 to 0 and everything else to 1, in place.
1030 #[display("OP_0NOTEQUAL")]
1031 NotEqual0 = OP_0NOTEQUAL,
1032 /// Pop two stack items and push their sum.
1033 #[display("OP_ADD")]
1034 Add = OP_ADD,
1035 /// Pop two stack items and push the second minus the top.
1036 #[display("OP_SUB")]
1037 Sub = OP_SUB,
1038 /// Fail the script unconditionally, does not even need to be executed.
1039 #[display("OP_MUL")]
1040 Mul = OP_MUL,
1041 /// Fail the script unconditionally, does not even need to be executed.
1042 #[display("OP_DIV")]
1043 Div = OP_DIV,
1044 /// Fail the script unconditionally, does not even need to be executed.
1045 #[display("OP_MOD")]
1046 Mod = OP_MOD,
1047 /// Fail the script unconditionally, does not even need to be executed.
1048 #[display("OP_LSHIFT")]
1049 LShift = OP_LSHIFT,
1050 /// Fail the script unconditionally, does not even need to be executed.
1051 #[display("OP_RSHIFT")]
1052 RShift = OP_RSHIFT,
1053 /// Pop the top two stack items and push 1 if both are nonzero, else push 0.
1054 #[display("OP_BOOLAND")]
1055 BoolAnd = OP_BOOLAND,
1056 /// Pop the top two stack items and push 1 if either is nonzero, else push 0.
1057 #[display("OP_BOOLOR")]
1058 BoolOr = OP_BOOLOR,
1059
1060 /// Pop the top two stack items and push 1 if both are numerically equal, else
1061 /// push 0.
1062 #[display("OP_NUMEQUAL")]
1063 NumEqual = OP_NUMEQUAL,
1064 /// Pop the top two stack items and return success if both are numerically
1065 /// equal, else return failure.
1066 #[display("OP_NUMEQUALVERIFY")]
1067 NumEqualVerify = OP_NUMEQUALVERIFY,
1068 /// Pop the top two stack items and push 0 if both are numerically equal, else
1069 /// push 1.
1070 #[display("OP_NUMNOTEQUAL")]
1071 NumNotEqual = OP_NUMNOTEQUAL,
1072 /// Pop the top two items; push 1 if the second is less than the top, 0
1073 /// otherwise.
1074 #[display("OP_LESSTHAN")]
1075 LessThan = OP_LESSTHAN,
1076 /// Pop the top two items; push 1 if the second is greater than the top, 0
1077 /// otherwise.
1078 #[display("OP_GREATERTHAN")]
1079 GreaterThan = OP_GREATERTHAN,
1080 /// Pop the top two items; push 1 if the second is <= the top, 0 otherwise.
1081 #[display("OP_LESSTHANOREQUAL")]
1082 LessThanOrEqual = OP_LESSTHANOREQUAL,
1083 /// Pop the top two items; push 1 if the second is >= the top, 0 otherwise.
1084 #[display("OP_GREATERTHANOREQUAL")]
1085 GreaterThanOrEqual = OP_GREATERTHANOREQUAL,
1086 /// Pop the top two items; push the smaller.
1087 #[display("OP_MIN")]
1088 Min = OP_MIN,
1089 /// Pop the top two items; push the larger.
1090 #[display("OP_MAX")]
1091 Max = OP_MAX,
1092 /// Pop the top three items; if the top is >= the second and < the third, push
1093 /// 1, otherwise push 0.
1094 #[display("OP_WITHIN")]
1095 Within = OP_WITHIN,
1096
1097 /// Pop the top stack item and push its RIPEMD160 hash.
1098 #[display("OP_RIPEMD160")]
1099 Ripemd160 = OP_RIPEMD160,
1100 /// Pop the top stack item and push its SHA1 hash.
1101 #[display("OP_SHA1")]
1102 Sha1 = OP_SHA1,
1103 /// Pop the top stack item and push its SHA256 hash.
1104 #[display("OP_SHA256")]
1105 Sha256 = OP_SHA256,
1106 /// Pop the top stack item and push its RIPEMD(SHA256) hash.
1107 #[display("OP_HASH160")]
1108 Hash160 = OP_HASH160,
1109 /// Pop the top stack item and push its SHA256(SHA256) hash.
1110 #[display("OP_HASH256")]
1111 Hash256 = OP_HASH256,
1112
1113 /// Ignore this and everything preceding when deciding what to sign when
1114 /// signature-checking.
1115 #[display("OP_CODESEPARATOR")]
1116 CodeSeparator = OP_CODESEPARATOR,
1117
1118 /// <https://en.bitcoin.it/wiki/OP_CHECKSIG> pushing 1/0 for success/failure.
1119 #[display("OP_CHECKSIG")]
1120 CheckSig = OP_CHECKSIG,
1121 /// <https://en.bitcoin.it/wiki/OP_CHECKSIG> returning success/failure.
1122 #[display("OP_CHECKSIGVERIFY")]
1123 CheckSigVerify = OP_CHECKSIGVERIFY,
1124 /// Pop N, N pubkeys, M, M signatures, a dummy (due to bug in reference code),
1125 /// and verify that all M signatures are valid. Push 1 for 'all valid', 0
1126 /// otherwise.
1127 #[display("OP_CHECKMULTISIG")]
1128 CheckMultiSig = OP_CHECKMULTISIG,
1129 /// Like the above but return success/failure.
1130 #[display("OP_CHECKMULTISIGVERIFY")]
1131 CheckMultisigVerify = OP_CHECKMULTISIGVERIFY,
1132
1133 /// Does nothing.
1134 #[display("OP_NOP1")]
1135 Nop1 = OP_NOP1,
1136 /// <https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki>
1137 #[display("OP_CLTV")]
1138 Cltv = OP_CLTV,
1139 /// <https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki>
1140 #[display("OP_CSV")]
1141 Csv = OP_CSV,
1142 /// Does nothing.
1143 #[display("OP_NOP4")]
1144 Nop4 = OP_NOP4,
1145 /// Does nothing.
1146 #[display("OP_NOP5")]
1147 Nop5 = OP_NOP5,
1148 /// Does nothing.
1149 #[display("OP_NOP6")]
1150 Nop6 = OP_NOP6,
1151 /// Does nothing.
1152 #[display("OP_NOP7")]
1153 Nop7 = OP_NOP7,
1154 /// Does nothing.
1155 #[display("OP_NOP8")]
1156 Nop8 = OP_NOP8,
1157 /// Does nothing.
1158 #[display("OP_NOP9")]
1159 Nop9 = OP_NOP9,
1160 /// Does nothing.
1161 #[display("OP_NOP10")]
1162 Nop10 = OP_NOP10,
1163
1164 // Every other opcode acts as OP_RETURN
1165 /// Synonym for OP_RETURN.
1166 #[display("OP_INVALIDOPCODE")]
1167 InvalidOpCode = OP_INVALIDOPCODE,
1168}