bc/opcodes.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
// Bitcoin protocol consensus library.
//
// SPDX-License-Identifier: Apache-2.0
//
// Written in 2019-2024 by
// Dr Maxim Orlovsky <orlovsky@lnp-bp.org>
//
// Copyright (C) 2019-2024 LNP/BP Standards Association. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::LIB_NAME_BITCOIN;
/// Push an empty array onto the stack.
pub const OP_PUSHBYTES_0: u8 = 0x00;
/// Push the next byte as an array onto the stack.
pub const OP_PUSHBYTES_1: u8 = 0x01;
/// Push the next 2 bytes as an array onto the stack.
pub const OP_PUSHBYTES_2: u8 = 0x02;
/// Push the next 3 bytes as an array onto the stack.
pub const OP_PUSHBYTES_3: u8 = 0x03;
/// Push the next 4 bytes as an array onto the stack.
pub const OP_PUSHBYTES_4: u8 = 0x04;
/// Push the next 5 bytes as an array onto the stack.
pub const OP_PUSHBYTES_5: u8 = 0x05;
/// Push the next 6 bytes as an array onto the stack.
pub const OP_PUSHBYTES_6: u8 = 0x06;
/// Push the next 7 bytes as an array onto the stack.
pub const OP_PUSHBYTES_7: u8 = 0x07;
/// Push the next 8 bytes as an array onto the stack.
pub const OP_PUSHBYTES_8: u8 = 0x08;
/// Push the next 9 bytes as an array onto the stack.
pub const OP_PUSHBYTES_9: u8 = 0x09;
/// Push the next 10 bytes as an array onto the stack.
pub const OP_PUSHBYTES_10: u8 = 0x0a;
/// Push the next 11 bytes as an array onto the stack.
pub const OP_PUSHBYTES_11: u8 = 0x0b;
/// Push the next 12 bytes as an array onto the stack.
pub const OP_PUSHBYTES_12: u8 = 0x0c;
/// Push the next 13 bytes as an array onto the stack.
pub const OP_PUSHBYTES_13: u8 = 0x0d;
/// Push the next 14 bytes as an array onto the stack.
pub const OP_PUSHBYTES_14: u8 = 0x0e;
/// Push the next 15 bytes as an array onto the stack.
pub const OP_PUSHBYTES_15: u8 = 0x0f;
/// Push the next 16 bytes as an array onto the stack.
pub const OP_PUSHBYTES_16: u8 = 0x10;
/// Push the next 17 bytes as an array onto the stack.
pub const OP_PUSHBYTES_17: u8 = 0x11;
/// Push the next 18 bytes as an array onto the stack.
pub const OP_PUSHBYTES_18: u8 = 0x12;
/// Push the next 19 bytes as an array onto the stack.
pub const OP_PUSHBYTES_19: u8 = 0x13;
/// Push the next 20 bytes as an array onto the stack.
pub const OP_PUSHBYTES_20: u8 = 0x14;
/// Push the next 21 bytes as an array onto the stack.
pub const OP_PUSHBYTES_21: u8 = 0x15;
/// Push the next 22 bytes as an array onto the stack.
pub const OP_PUSHBYTES_22: u8 = 0x16;
/// Push the next 23 bytes as an array onto the stack.
pub const OP_PUSHBYTES_23: u8 = 0x17;
/// Push the next 24 bytes as an array onto the stack.
pub const OP_PUSHBYTES_24: u8 = 0x18;
/// Push the next 25 bytes as an array onto the stack.
pub const OP_PUSHBYTES_25: u8 = 0x19;
/// Push the next 26 bytes as an array onto the stack.
pub const OP_PUSHBYTES_26: u8 = 0x1a;
/// Push the next 27 bytes as an array onto the stack.
pub const OP_PUSHBYTES_27: u8 = 0x1b;
/// Push the next 28 bytes as an array onto the stack.
pub const OP_PUSHBYTES_28: u8 = 0x1c;
/// Push the next 29 bytes as an array onto the stack.
pub const OP_PUSHBYTES_29: u8 = 0x1d;
/// Push the next 30 bytes as an array onto the stack.
pub const OP_PUSHBYTES_30: u8 = 0x1e;
/// Push the next 31 bytes as an array onto the stack.
pub const OP_PUSHBYTES_31: u8 = 0x1f;
/// Push the next 32 bytes as an array onto the stack.
pub const OP_PUSHBYTES_32: u8 = 0x20;
/// Push the next 33 bytes as an array onto the stack.
pub const OP_PUSHBYTES_33: u8 = 0x21;
/// Push the next 34 bytes as an array onto the stack.
pub const OP_PUSHBYTES_34: u8 = 0x22;
/// Push the next 35 bytes as an array onto the stack.
pub const OP_PUSHBYTES_35: u8 = 0x23;
/// Push the next 36 bytes as an array onto the stack.
pub const OP_PUSHBYTES_36: u8 = 0x24;
/// Push the next 37 bytes as an array onto the stack.
pub const OP_PUSHBYTES_37: u8 = 0x25;
/// Push the next 38 bytes as an array onto the stack.
pub const OP_PUSHBYTES_38: u8 = 0x26;
/// Push the next 39 bytes as an array onto the stack.
pub const OP_PUSHBYTES_39: u8 = 0x27;
/// Push the next 40 bytes as an array onto the stack.
pub const OP_PUSHBYTES_40: u8 = 0x28;
/// Push the next 41 bytes as an array onto the stack.
pub const OP_PUSHBYTES_41: u8 = 0x29;
/// Push the next 42 bytes as an array onto the stack.
pub const OP_PUSHBYTES_42: u8 = 0x2a;
/// Push the next 43 bytes as an array onto the stack.
pub const OP_PUSHBYTES_43: u8 = 0x2b;
/// Push the next 44 bytes as an array onto the stack.
pub const OP_PUSHBYTES_44: u8 = 0x2c;
/// Push the next 45 bytes as an array onto the stack.
pub const OP_PUSHBYTES_45: u8 = 0x2d;
/// Push the next 46 bytes as an array onto the stack.
pub const OP_PUSHBYTES_46: u8 = 0x2e;
/// Push the next 47 bytes as an array onto the stack.
pub const OP_PUSHBYTES_47: u8 = 0x2f;
/// Push the next 48 bytes as an array onto the stack.
pub const OP_PUSHBYTES_48: u8 = 0x30;
/// Push the next 49 bytes as an array onto the stack.
pub const OP_PUSHBYTES_49: u8 = 0x31;
/// Push the next 50 bytes as an array onto the stack.
pub const OP_PUSHBYTES_50: u8 = 0x32;
/// Push the next 51 bytes as an array onto the stack.
pub const OP_PUSHBYTES_51: u8 = 0x33;
/// Push the next 52 bytes as an array onto the stack.
pub const OP_PUSHBYTES_52: u8 = 0x34;
/// Push the next 53 bytes as an array onto the stack.
pub const OP_PUSHBYTES_53: u8 = 0x35;
/// Push the next 54 bytes as an array onto the stack.
pub const OP_PUSHBYTES_54: u8 = 0x36;
/// Push the next 55 bytes as an array onto the stack.
pub const OP_PUSHBYTES_55: u8 = 0x37;
/// Push the next 56 bytes as an array onto the stack.
pub const OP_PUSHBYTES_56: u8 = 0x38;
/// Push the next 57 bytes as an array onto the stack.
pub const OP_PUSHBYTES_57: u8 = 0x39;
/// Push the next 58 bytes as an array onto the stack.
pub const OP_PUSHBYTES_58: u8 = 0x3a;
/// Push the next 59 bytes as an array onto the stack.
pub const OP_PUSHBYTES_59: u8 = 0x3b;
/// Push the next 60 bytes as an array onto the stack.
pub const OP_PUSHBYTES_60: u8 = 0x3c;
/// Push the next 61 bytes as an array onto the stack.
pub const OP_PUSHBYTES_61: u8 = 0x3d;
/// Push the next 62 bytes as an array onto the stack.
pub const OP_PUSHBYTES_62: u8 = 0x3e;
/// Push the next 63 bytes as an array onto the stack.
pub const OP_PUSHBYTES_63: u8 = 0x3f;
/// Push the next 64 bytes as an array onto the stack.
pub const OP_PUSHBYTES_64: u8 = 0x40;
/// Push the next 65 bytes as an array onto the stack.
pub const OP_PUSHBYTES_65: u8 = 0x41;
/// Push the next 66 bytes as an array onto the stack.
pub const OP_PUSHBYTES_66: u8 = 0x42;
/// Push the next 67 bytes as an array onto the stack.
pub const OP_PUSHBYTES_67: u8 = 0x43;
/// Push the next 68 bytes as an array onto the stack.
pub const OP_PUSHBYTES_68: u8 = 0x44;
/// Push the next 69 bytes as an array onto the stack.
pub const OP_PUSHBYTES_69: u8 = 0x45;
/// Push the next 70 bytes as an array onto the stack.
pub const OP_PUSHBYTES_70: u8 = 0x46;
/// Push the next 71 bytes as an array onto the stack.
pub const OP_PUSHBYTES_71: u8 = 0x47;
/// Push the next 72 bytes as an array onto the stack.
pub const OP_PUSHBYTES_72: u8 = 0x48;
/// Push the next 73 bytes as an array onto the stack.
pub const OP_PUSHBYTES_73: u8 = 0x49;
/// Push the next 74 bytes as an array onto the stack.
pub const OP_PUSHBYTES_74: u8 = 0x4a;
/// Push the next 75 bytes as an array onto the stack.
pub const OP_PUSHBYTES_75: u8 = 0x4b;
/// Read the next byte as N; push the next N bytes as an array onto the stack.
pub const OP_PUSHDATA1: u8 = 0x4c;
/// Read the next 2 bytes as N; push the next N bytes as an array onto the
/// stack.
pub const OP_PUSHDATA2: u8 = 0x4d;
/// Read the next 4 bytes as N; push the next N bytes as an array onto the
/// stack.
pub const OP_PUSHDATA4: u8 = 0x4e;
/// Push the array `0x81` onto the stack.
pub const OP_PUSHNUM_NEG1: u8 = 0x4f;
/// Synonym for OP_RETURN.
pub const OP_RESERVED: u8 = 0x50;
/// Push the array `0x01` onto the stack.
pub const OP_PUSHNUM_1: u8 = 0x51;
/// the array `0x02` onto the stack.
pub const OP_PUSHNUM_2: u8 = 0x52;
/// Push the array `0x03` onto the stack.
pub const OP_PUSHNUM_3: u8 = 0x53;
/// Push the array `0x04` onto the stack.
pub const OP_PUSHNUM_4: u8 = 0x54;
/// Push the array `0x05` onto the stack.
pub const OP_PUSHNUM_5: u8 = 0x55;
/// Push the array `0x06` onto the stack.
pub const OP_PUSHNUM_6: u8 = 0x56;
/// Push the array `0x07` onto the stack.
pub const OP_PUSHNUM_7: u8 = 0x57;
/// Push the array `0x08` onto the stack.
pub const OP_PUSHNUM_8: u8 = 0x58;
/// Push the array `0x09` onto the stack.
pub const OP_PUSHNUM_9: u8 = 0x59;
/// Push the array `0x0a` onto the stack.
pub const OP_PUSHNUM_10: u8 = 0x5a;
/// Push the array `0x0b` onto the stack.
pub const OP_PUSHNUM_11: u8 = 0x5b;
/// Push the array `0x0c` onto the stack.
pub const OP_PUSHNUM_12: u8 = 0x5c;
/// Push the array `0x0d` onto the stack.
pub const OP_PUSHNUM_13: u8 = 0x5d;
/// Push the array `0x0e` onto the stack.
pub const OP_PUSHNUM_14: u8 = 0x5e;
/// Push the array `0x0f` onto the stack.
pub const OP_PUSHNUM_15: u8 = 0x5f;
/// Push the array `0x10` onto the stack.
pub const OP_PUSHNUM_16: u8 = 0x60;
/// Does nothing.
pub const OP_NOP: u8 = 0x61;
/// Synonym for OP_RETURN.
pub const OP_VER: u8 = 0x62;
/// Pop and execute the next statements if a nonzero element was popped.
pub const OP_IF: u8 = 0x63;
/// Pop and execute the next statements if a zero element was popped.
pub const OP_NOTIF: u8 = 0x64;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_VERIF: u8 = 0x65;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_VERNOTIF: u8 = 0x66;
/// Execute statements if those after the previous OP_IF were not, and
/// vice-versa. If there is no previous OP_IF, this acts as an OP_RETURN.
pub const OP_ELSE: u8 = 0x67;
/// Pop and execute the next statements if a zero element was popped.
pub const OP_ENDIF: u8 = 0x68;
/// If the top value is zero or the stack is empty, fail; otherwise, pop the
/// stack.
pub const OP_VERIFY: u8 = 0x69;
/// Fail the script immediately. (Must be executed.).
pub const OP_RETURN: u8 = 0x6a;
/// Pop one element from the main stack onto the alt stack.
pub const OP_TOALTSTACK: u8 = 0x6b;
/// Pop one element from the alt stack onto the main stack.
pub const OP_FROMALTSTACK: u8 = 0x6c;
/// Drops the top two stack items.
pub const OP_2DROP: u8 = 0x6d;
/// Duplicates the top two stack items as AB -> ABAB.
pub const OP_2DUP: u8 = 0x6e;
/// Duplicates the two three stack items as ABC -> ABCABC.
pub const OP_3DUP: u8 = 0x6f;
/// Copies the two stack items of items two spaces back to the front, as xxAB ->
/// ABxxAB.
pub const OP_2OVER: u8 = 0x70;
/// Moves the two stack items four spaces back to the front, as xxxxAB ->
/// ABxxxx.
pub const OP_2ROT: u8 = 0x71;
/// Swaps the top two pairs, as ABCD -> CDAB.
pub const OP_2SWAP: u8 = 0x72;
/// Duplicate the top stack element unless it is zero.
pub const OP_IFDUP: u8 = 0x73;
/// Push the current number of stack items onto the stack.
pub const OP_DEPTH: u8 = 0x74;
/// Drops the top stack item.
pub const OP_DROP: u8 = 0x75;
/// Duplicates the top stack item.
pub const OP_DUP: u8 = 0x76;
/// Drops the second-to-top stack item.
pub const OP_NIP: u8 = 0x77;
/// Copies the second-to-top stack item, as xA -> AxA.
pub const OP_OVER: u8 = 0x78;
/// Pop the top stack element as N. Copy the Nth stack element to the top.
pub const OP_PICK: u8 = 0x79;
/// Pop the top stack element as N. Move the Nth stack element to the top.
pub const OP_ROLL: u8 = 0x7a;
/// Rotate the top three stack items, as [top next1 next2] -> [next2 top next1].
pub const OP_ROT: u8 = 0x7b;
/// Swap the top two stack items.
pub const OP_SWAP: u8 = 0x7c;
/// Copy the top stack item to before the second item, as [top next] -> [top
/// next top].
pub const OP_TUCK: u8 = 0x7d;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_CAT: u8 = 0x7e;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_SUBSTR: u8 = 0x7f;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_LEFT: u8 = 0x80;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_RIGHT: u8 = 0x81;
/// Pushes the length of the top stack item onto the stack.
pub const OP_SIZE: u8 = 0x82;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_INVERT: u8 = 0x83;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_AND: u8 = 0x84;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_OR: u8 = 0x85;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_XOR: u8 = 0x86;
/// Pushes 1 if the inputs are exactly equal, 0 otherwise.
pub const OP_EQUAL: u8 = 0x87;
/// Returns success if the inputs are exactly equal, failure otherwise.
pub const OP_EQUALVERIFY: u8 = 0x88;
/// Synonym for OP_RETURN.
pub const OP_RESERVED1: u8 = 0x89;
/// Synonym for OP_RETURN.
pub const OP_RESERVED2: u8 = 0x8a;
/// Increment the top stack element in place.
pub const OP_1ADD: u8 = 0x8b;
/// Decrement the top stack element in place.
pub const OP_1SUB: u8 = 0x8c;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_2MUL: u8 = 0x8d;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_2DIV: u8 = 0x8e;
/// Multiply the top stack item by -1 in place.
pub const OP_NEGATE: u8 = 0x8f;
/// Absolute value the top stack item in place.
pub const OP_ABS: u8 = 0x90;
/// Map 0 to 1 and everything else to 0, in place.
pub const OP_NOT: u8 = 0x91;
/// Map 0 to 0 and everything else to 1, in place.
pub const OP_0NOTEQUAL: u8 = 0x92;
/// Pop two stack items and push their sum.
pub const OP_ADD: u8 = 0x93;
/// Pop two stack items and push the second minus the top.
pub const OP_SUB: u8 = 0x94;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_MUL: u8 = 0x95;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_DIV: u8 = 0x96;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_MOD: u8 = 0x97;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_LSHIFT: u8 = 0x98;
/// Fail the script unconditionally, does not even need to be executed.
pub const OP_RSHIFT: u8 = 0x99;
/// Pop the top two stack items and push 1 if both are nonzero, else push 0.
pub const OP_BOOLAND: u8 = 0x9a;
/// Pop the top two stack items and push 1 if either is nonzero, else push 0.
pub const OP_BOOLOR: u8 = 0x9b;
/// Pop the top two stack items and push 1 if both are numerically equal, else
/// push 0.
pub const OP_NUMEQUAL: u8 = 0x9c;
/// Pop the top two stack items and return success if both are numerically
/// equal, else return failure.
pub const OP_NUMEQUALVERIFY: u8 = 0x9d;
/// Pop the top two stack items and push 0 if both are numerically equal, else
/// push 1.
pub const OP_NUMNOTEQUAL: u8 = 0x9e;
/// Pop the top two items; push 1 if the second is less than the top, 0
/// otherwise.
pub const OP_LESSTHAN: u8 = 0x9f;
/// Pop the top two items; push 1 if the second is greater than the top, 0
/// otherwise.
pub const OP_GREATERTHAN: u8 = 0xa0;
/// Pop the top two items; push 1 if the second is <= the top, 0 otherwise.
pub const OP_LESSTHANOREQUAL: u8 = 0xa1;
/// Pop the top two items; push 1 if the second is >= the top, 0 otherwise.
pub const OP_GREATERTHANOREQUAL: u8 = 0xa2;
/// Pop the top two items; push the smaller.
pub const OP_MIN: u8 = 0xa3;
/// Pop the top two items; push the larger.
pub const OP_MAX: u8 = 0xa4;
/// Pop the top three items; if the top is >= the second and < the third, push
/// 1, otherwise push 0.
pub const OP_WITHIN: u8 = 0xa5;
/// Pop the top stack item and push its RIPEMD160 hash.
pub const OP_RIPEMD160: u8 = 0xa6;
/// Pop the top stack item and push its SHA1 hash.
pub const OP_SHA1: u8 = 0xa7;
/// Pop the top stack item and push its SHA256 hash.
pub const OP_SHA256: u8 = 0xa8;
/// Pop the top stack item and push its RIPEMD(SHA256) hash.
pub const OP_HASH160: u8 = 0xa9;
/// Pop the top stack item and push its SHA256(SHA256) hash.
pub const OP_HASH256: u8 = 0xaa;
/// Ignore this and everything preceding when deciding what to sign when
/// signature-checking.
pub const OP_CODESEPARATOR: u8 = 0xab;
/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> pushing 1/0 for success/failure.
pub const OP_CHECKSIG: u8 = 0xac;
/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> returning success/failure.
pub const OP_CHECKSIGVERIFY: u8 = 0xad;
/// Pop N, N pubkeys, M, M signatures, a dummy (due to bug in reference code),
/// and verify that all M signatures are valid. Push 1 for 'all valid', 0
/// otherwise.
pub const OP_CHECKMULTISIG: u8 = 0xae;
/// Like the above but return success/failure.
pub const OP_CHECKMULTISIGVERIFY: u8 = 0xaf;
/// Does nothing.
pub const OP_NOP1: u8 = 0xb0;
/// <https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki>
pub const OP_CLTV: u8 = 0xb1;
/// <https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki>
pub const OP_CSV: u8 = 0xb2;
/// Does nothing.
pub const OP_NOP4: u8 = 0xb3;
/// Does nothing.
pub const OP_NOP5: u8 = 0xb4;
/// Does nothing.
pub const OP_NOP6: u8 = 0xb5;
/// Does nothing.
pub const OP_NOP7: u8 = 0xb6;
/// Does nothing.
pub const OP_NOP8: u8 = 0xb7;
/// Does nothing.
pub const OP_NOP9: u8 = 0xb8;
/// Does nothing.
pub const OP_NOP10: u8 = 0xb9;
// Every other opcode acts as OP_RETURN
/// OP_CHECKSIGADD post tapscript.
pub const OP_CHECKSIGADD: u8 = 0xba;
/// Synonym for OP_RETURN.
pub const OP_RETURN_187: u8 = 0xbb;
/// Synonym for OP_RETURN.
pub const OP_RETURN_188: u8 = 0xbc;
/// Synonym for OP_RETURN.
pub const OP_RETURN_189: u8 = 0xbd;
/// Synonym for OP_RETURN.
pub const OP_RETURN_190: u8 = 0xbe;
/// Synonym for OP_RETURN.
pub const OP_RETURN_191: u8 = 0xbf;
/// Synonym for OP_RETURN.
pub const OP_RETURN_192: u8 = 0xc0;
/// Synonym for OP_RETURN.
pub const OP_RETURN_193: u8 = 0xc1;
/// Synonym for OP_RETURN.
pub const OP_RETURN_194: u8 = 0xc2;
/// Synonym for OP_RETURN.
pub const OP_RETURN_195: u8 = 0xc3;
/// Synonym for OP_RETURN.
pub const OP_RETURN_196: u8 = 0xc4;
/// Synonym for OP_RETURN.
pub const OP_RETURN_197: u8 = 0xc5;
/// Synonym for OP_RETURN.
pub const OP_RETURN_198: u8 = 0xc6;
/// Synonym for OP_RETURN.
pub const OP_RETURN_199: u8 = 0xc7;
/// Synonym for OP_RETURN.
pub const OP_RETURN_200: u8 = 0xc8;
/// Synonym for OP_RETURN.
pub const OP_RETURN_201: u8 = 0xc9;
/// Synonym for OP_RETURN.
pub const OP_RETURN_202: u8 = 0xca;
/// Synonym for OP_RETURN.
pub const OP_RETURN_203: u8 = 0xcb;
/// Synonym for OP_RETURN.
pub const OP_RETURN_204: u8 = 0xcc;
/// Synonym for OP_RETURN.
pub const OP_RETURN_205: u8 = 0xcd;
/// Synonym for OP_RETURN.
pub const OP_RETURN_206: u8 = 0xce;
/// Synonym for OP_RETURN.
pub const OP_RETURN_207: u8 = 0xcf;
/// Synonym for OP_RETURN.
pub const OP_RETURN_208: u8 = 0xd0;
/// Synonym for OP_RETURN.
pub const OP_RETURN_209: u8 = 0xd1;
/// Synonym for OP_RETURN.
pub const OP_RETURN_210: u8 = 0xd2;
/// Synonym for OP_RETURN.
pub const OP_RETURN_211: u8 = 0xd3;
/// Synonym for OP_RETURN.
pub const OP_RETURN_212: u8 = 0xd4;
/// Synonym for OP_RETURN.
pub const OP_RETURN_213: u8 = 0xd5;
/// Synonym for OP_RETURN.
pub const OP_RETURN_214: u8 = 0xd6;
/// Synonym for OP_RETURN.
pub const OP_RETURN_215: u8 = 0xd7;
/// Synonym for OP_RETURN.
pub const OP_RETURN_216: u8 = 0xd8;
/// Synonym for OP_RETURN.
pub const OP_RETURN_217: u8 = 0xd9;
/// Synonym for OP_RETURN.
pub const OP_RETURN_218: u8 = 0xda;
/// Synonym for OP_RETURN.
pub const OP_RETURN_219: u8 = 0xdb;
/// Synonym for OP_RETURN.
pub const OP_RETURN_220: u8 = 0xdc;
/// Synonym for OP_RETURN.
pub const OP_RETURN_221: u8 = 0xdd;
/// Synonym for OP_RETURN.
pub const OP_RETURN_222: u8 = 0xde;
/// Synonym for OP_RETURN.
pub const OP_RETURN_223: u8 = 0xdf;
/// Synonym for OP_RETURN.
pub const OP_RETURN_224: u8 = 0xe0;
/// Synonym for OP_RETURN.
pub const OP_RETURN_225: u8 = 0xe1;
/// Synonym for OP_RETURN.
pub const OP_RETURN_226: u8 = 0xe2;
/// Synonym for OP_RETURN.
pub const OP_RETURN_227: u8 = 0xe3;
/// Synonym for OP_RETURN.
pub const OP_RETURN_228: u8 = 0xe4;
/// Synonym for OP_RETURN.
pub const OP_RETURN_229: u8 = 0xe5;
/// Synonym for OP_RETURN.
pub const OP_RETURN_230: u8 = 0xe6;
/// Synonym for OP_RETURN.
pub const OP_RETURN_231: u8 = 0xe7;
/// Synonym for OP_RETURN.
pub const OP_RETURN_232: u8 = 0xe8;
/// Synonym for OP_RETURN.
pub const OP_RETURN_233: u8 = 0xe9;
/// Synonym for OP_RETURN.
pub const OP_RETURN_234: u8 = 0xea;
/// Synonym for OP_RETURN.
pub const OP_RETURN_235: u8 = 0xeb;
/// Synonym for OP_RETURN.
pub const OP_RETURN_236: u8 = 0xec;
/// Synonym for OP_RETURN.
pub const OP_RETURN_237: u8 = 0xed;
/// Synonym for OP_RETURN.
pub const OP_RETURN_238: u8 = 0xee;
/// Synonym for OP_RETURN.
pub const OP_RETURN_239: u8 = 0xef;
/// Synonym for OP_RETURN.
pub const OP_RETURN_240: u8 = 0xf0;
/// Synonym for OP_RETURN.
pub const OP_RETURN_241: u8 = 0xf1;
/// Synonym for OP_RETURN.
pub const OP_RETURN_242: u8 = 0xf2;
/// Synonym for OP_RETURN.
pub const OP_RETURN_243: u8 = 0xf3;
/// Synonym for OP_RETURN.
pub const OP_RETURN_244: u8 = 0xf4;
/// Synonym for OP_RETURN.
pub const OP_RETURN_245: u8 = 0xf5;
/// Synonym for OP_RETURN.
pub const OP_RETURN_246: u8 = 0xf6;
/// Synonym for OP_RETURN.
pub const OP_RETURN_247: u8 = 0xf7;
/// Synonym for OP_RETURN.
pub const OP_RETURN_248: u8 = 0xf8;
/// Synonym for OP_RETURN.
pub const OP_RETURN_249: u8 = 0xf9;
/// Synonym for OP_RETURN.
pub const OP_RETURN_250: u8 = 0xfa;
/// Synonym for OP_RETURN.
pub const OP_RETURN_251: u8 = 0xfb;
/// Synonym for OP_RETURN.
pub const OP_RETURN_252: u8 = 0xfc;
/// Synonym for OP_RETURN.
pub const OP_RETURN_253: u8 = 0xfd;
/// Synonym for OP_RETURN.
pub const OP_RETURN_254: u8 = 0xfe;
/// Synonym for OP_RETURN.
pub const OP_INVALIDOPCODE: u8 = 0xff;
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Display)]
#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_BITCOIN, tags = repr, into_u8, try_from_u8)]
#[non_exhaustive]
#[repr(u8)]
pub enum OpCode {
/// Push an empty array onto the stack.
#[display("OP_PUSH_BYTES0")]
PushBytes0 = OP_PUSHBYTES_0,
/// Push the next byte as an array onto the stack.
#[display("OP_PUSH_BYTES1")]
PushBytes1 = OP_PUSHBYTES_1,
/// Push the next 2 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES2")]
PushBytes2 = OP_PUSHBYTES_2,
/// Push the next 3 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES3")]
PushBytes3 = OP_PUSHBYTES_3,
/// Push the next 4 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES4")]
PushBytes4 = OP_PUSHBYTES_4,
/// Push the next 5 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES5")]
PushBytes5 = OP_PUSHBYTES_5,
/// Push the next 6 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES6")]
PushBytes6 = OP_PUSHBYTES_6,
/// Push the next 7 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES7")]
PushBytes7 = OP_PUSHBYTES_7,
/// Push the next 8 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES8")]
PushBytes8 = OP_PUSHBYTES_8,
/// Push the next 9 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES9")]
PushBytes9 = OP_PUSHBYTES_9,
/// Push the next 10 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES10")]
PushBytes10 = OP_PUSHBYTES_10,
/// Push the next 11 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES11")]
PushBytes11 = OP_PUSHBYTES_11,
/// Push the next 12 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES12")]
PushBytes12 = OP_PUSHBYTES_12,
/// Push the next 13 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES13")]
PushBytes13 = OP_PUSHBYTES_13,
/// Push the next 14 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES14")]
PushBytes14 = OP_PUSHBYTES_14,
/// Push the next 15 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES15")]
PushBytes15 = OP_PUSHBYTES_15,
/// Push the next 16 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES16")]
PushBytes16 = OP_PUSHBYTES_16,
/// Push the next 17 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES17")]
PushBytes17 = OP_PUSHBYTES_17,
/// Push the next 18 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES18")]
PushBytes18 = OP_PUSHBYTES_18,
/// Push the next 19 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES19")]
PushBytes19 = OP_PUSHBYTES_19,
/// Push the next 20 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES20")]
PushBytes20 = OP_PUSHBYTES_20,
/// Push the next 21 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES21")]
PushBytes21 = OP_PUSHBYTES_21,
/// Push the next 22 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES22")]
PushBytes22 = OP_PUSHBYTES_22,
/// Push the next 23 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES23")]
PushBytes23 = OP_PUSHBYTES_23,
/// Push the next 24 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES24")]
PushBytes24 = OP_PUSHBYTES_24,
/// Push the next 25 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES25")]
PushBytes25 = OP_PUSHBYTES_25,
/// Push the next 26 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES26")]
PushBytes26 = OP_PUSHBYTES_26,
/// Push the next 27 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES27")]
PushBytes27 = OP_PUSHBYTES_27,
/// Push the next 28 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES28")]
PushBytes28 = OP_PUSHBYTES_28,
/// Push the next 29 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES29")]
PushBytes29 = OP_PUSHBYTES_29,
/// Push the next 30 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES30")]
PushBytes30 = OP_PUSHBYTES_30,
/// Push the next 30 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES31")]
PushBytes31 = OP_PUSHBYTES_31,
/// Push the next 32 bytes as an array onto the stack.
#[display("OP_PUSH_BYTES32")]
PushBytes32 = OP_PUSHBYTES_32,
/// Read the next byte as N; push the next N bytes as an array onto the
/// stack.
#[display("OP_PUSH_DATA1")]
PushData1 = OP_PUSHDATA1,
/// Read the next 2 bytes as N; push the next N bytes as an array onto the
/// stack.
#[display("OP_PUSH_DATA2")]
PushData2 = OP_PUSHDATA2,
/// Read the next 4 bytes as N; push the next N bytes as an array onto the
/// stack.
#[display("OP_PUSH_DATA3")]
PushData4 = OP_PUSHDATA4,
/// Push the array `0x01` onto the stack.
#[display("OP_PUSHNUM_1")]
PushNum1 = OP_PUSHNUM_1,
/// Synonym for OP_RETURN.
Reserved = OP_RESERVED,
/// Fail the script immediately.
#[display("OP_RETURN")]
#[strict_type(dumb)]
Return = OP_RETURN,
/// Duplicates the top stack item.
#[display("OP_DUP")]
Dup = OP_DUP,
/// Pushes 1 if the inputs are exactly equal, 0 otherwise.
#[display("OP_EQUAL")]
Equal = OP_EQUAL,
/// Returns success if the inputs are exactly equal, failure otherwise.
#[display("OP_EQUALVERIFY")]
EqualVerify = OP_EQUALVERIFY,
/// Pop the top stack item and push its RIPEMD160 hash.
#[display("OP_RIPEMD160")]
Ripemd160 = OP_RIPEMD160,
/// Pop the top stack item and push its SHA1 hash.
#[display("OP_SHA1")]
Sha1 = OP_SHA1,
/// Pop the top stack item and push its SHA256 hash.
#[display("OP_SHA256")]
Sha256 = OP_SHA256,
/// Pop the top stack item and push its RIPEMD(SHA256) hash.
#[display("OP_HASH160")]
Hash160 = OP_HASH160,
/// Pop the top stack item and push its SHA256(SHA256) hash.
#[display("OP_HASH256")]
Hash256 = OP_HASH256,
/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> pushing 1/0 for success/failure.
#[display("OP_CHECKSIG")]
CheckSig = OP_CHECKSIG,
/// <https://en.bitcoin.it/wiki/OP_CHECKSIG> returning success/failure.
#[display("OP_CHECKSIGVERIFY")]
CheckSigVerify = OP_CHECKSIGVERIFY,
}