| Pushes |
|---|
OP_0 | BASE + WRITE(0) | an empty value | 1,100 |
Data push of n bytes | BASE + WRITE(n) | n = 32 | 1,324 |
OP_1 to OP_16 | BASE + WRITE(1) | OP_16 | 1,156 |
| Control |
|---|
OP_NOP, OP_NOP1, OP_NOP4 to OP_NOP10 | BASE | | 300 |
OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF | BASE each, also in an inactive branch; skipped instructions cost nothing | OP_IF on a true value | 300 |
OP_VERIFY | BASE + READ(n) | n = 1 | 666 |
OP_CODESEPARATOR | BASE | | 300 |
OP_RETURN | fails | | |
OP_SUCCESSx | succeeds before any charge | | 0 |
| Stack |
|---|
OP_TOALTSTACK, OP_FROMALTSTACK | BASE + MOVE(1) | | 523 |
OP_DROP, OP_2DROP | BASE | | 300 |
OP_DUP | BASE + WRITE(n) | n = 32 | 1,324 |
OP_2DUP | BASE + WRITE(a) + WRITE(b) | two 32-byte values | 2,348 |
OP_3DUP | BASE + WRITE(a) + WRITE(b) + WRITE(c) | three 32-byte values | 3,372 |
OP_OVER | BASE + WRITE(n) of the copied value | n = 32 | 1,324 |
OP_2OVER | BASE + WRITE(c) + WRITE(d) of the copied values | two 32-byte values | 2,348 |
OP_IFDUP | BASE + READ(n) + WRITE(n) if nonzero | a nonzero 32-byte value | 1,738 |
OP_PICK | BASE + READ(m) + WRITE(n), for an m-byte depth and the n-byte copy | depth 1 of 32-byte values | 1,690 |
OP_ROLL | BASE + READ(m) + MOVE(k + 1), for an m-byte depth k | depth 10 | 1,119 |
OP_SWAP, OP_NIP | BASE + MOVE(2) | | 546 |
OP_TUCK | BASE + WRITE(n) + MOVE(2) | n = 32 | 1,570 |
OP_ROT | BASE + MOVE(3) | | 569 |
OP_2SWAP | BASE + MOVE(4) | | 592 |
OP_2ROT | BASE + MOVE(6) | | 638 |
OP_DEPTH | BASE + WRITE(r) | 3 entries, r = 1 | 1,156 |
OP_SIZE | BASE + WRITE(r) | a 32-byte value, r = 1 | 1,156 |
| Splice |
|---|
OP_CAT | BASE + WRITE(a + b) | two 32-byte values | 1,548 |
OP_SUBSTR | BASE + READ(begin) + READ(len) + ARITH(out) | 16 bytes of a 32-byte value | 1,280 |
OP_LEFT | BASE + READ(offset) | 16 bytes of a 32-byte value | 666 |
OP_RIGHT | BASE + READ(offset) + ARITH(out) | 16 bytes of a 32-byte value | 914 |
| Bitwise |
|---|
OP_INVERT | BASE + READ(n) + ARITH(n) | n = 32 | 1,010 |
OP_AND, OP_OR, OP_XOR | BASE + READ(a) + READ(b) + ARITH(max(a, b)) | two 32-byte values | 1,424 |
OP_EQUAL | BASE + READ(n) if both sizes are n + WRITE(r) | two equal 32-byte values, r = 1 | 1,570 |
OP_EQUALVERIFY | BASE + READ(n) if both sizes are n | two equal 32-byte values | 714 |
OP_UPSHIFT | BASE + READ(n) + READ(bits) + ARITH(n) + WRITE(r) | an 8-byte number by 8 bits, r = 9 | 2,168 |
OP_DOWNSHIFT | BASE + READ(n) + READ(bits) + ARITH(n) | an 8-byte number by 8 bits | 1,256 |
| Arithmetic |
|---|
OP_1ADD, OP_2MUL | BASE + READ(n) + ARITH(n) + WRITE(r) | an 8-byte number, r = 8 | 1,746 |
OP_1SUB, OP_2DIV | BASE + READ(n) + ARITH(n) | an 8-byte number | 890 |
OP_NOT, OP_0NOTEQUAL | BASE + READ(n) + WRITE(r) | OP_0NOTEQUAL on an 8-byte number, r = 1 | 1,522 |
OP_ADD | BASE + READ(a) + READ(b) + ARITH(max(a, b)) + WRITE(r) | two 8-byte numbers, r = 8 | 2,112 |
OP_SUB | BASE + READ(a) + READ(b) + ARITH(max(a, b)) | two 8-byte numbers | 1,256 |
OP_MUL | BASE + READ(a) + READ(b) + MUL(n, m) + WRITE(W(a) + W(b)) | two 8-byte numbers | 2,860 |
OP_DIV, OP_MOD | BASE + READ(a) + READ(b) + DIV(n, m) | OP_DIV of 16 by 8 bytes | 2,830 |
OP_BOOLAND, OP_BOOLOR, OP_NUMEQUAL, OP_NUMNOTEQUAL, OP_LESSTHAN, OP_GREATERTHAN, OP_LESSTHANOREQUAL, OP_GREATERTHANOREQUAL | BASE + READ(a) + READ(b) + WRITE(r) | OP_NUMEQUAL of two 8-byte numbers, r = 1 | 1,888 |
OP_NUMEQUALVERIFY | BASE + READ(a) + READ(b) | two 8-byte numbers | 1,032 |
OP_MIN, OP_MAX | BASE + READ(a) + READ(b) | two 8-byte numbers | 1,032 |
OP_WITHIN | BASE + READ(min) + READ(max) + 2 READ(x) + WRITE(r) | three equal 8-byte numbers, r = 0 | 2,564 |
| Hashes |
|---|
OP_SHA256 | BASE + HASH(n) + WRITE(32) | n = 32 | 3,934 |
OP_RIPEMD160, OP_SHA1 | BASE + HASH(n) + WRITE(20) | n = 32 | 3,878 |
OP_HASH160 | BASE + HASH(n) + HASH(32) + WRITE(20) | a 33-byte public key | 6,488 |
OP_HASH256 | BASE + HASH(n) + HASH(32) + WRITE(32) | n = 32 | 6,544 |
| Signatures |
|---|
OP_CHECKSIG | BASE + WRITE(r), plus HASH(96) + SIG for a nonempty signature | a valid signature, r = 1 | 506,326 |
OP_CHECKSIGVERIFY | BASE, plus HASH(96) + SIG for a nonempty signature | a valid signature | 505,470 |
OP_CHECKSIGADD | BASE + READ(n) + WRITE(r), plus HASH(96) + SIG + ARITH(n) for a nonempty signature | a valid signature and a 1-byte count, r = 1 | 506,916 |
| Locks |
|---|
OP_CHECKLOCKTIMEVERIFY, OP_CHECKSEQUENCEVERIFY | BASE + READ(n) | a 4-byte operand | 666 |
| Extended Primitives |
|---|
OP_CHECKSIGFROMSTACK | BASE + WRITE(r), plus HASH(64 + n) + SIG for a nonempty signature | a valid signature on a 32-byte message, r = 1 | 506,326 |
OP_TWEAKADD | BASE + SIG + WRITE(32) | | 501,324 |
OP_BYTEREV | BASE + ARITH(n) | n = 32 | 596 |
| OP_TX |
|---|
OP_TX | BASE + READ per scope operand + OP_TX_SELECT(k) + WRITE of each result | the code separator position, one 4-byte number | 3,326 |
| Reusable Macros |
|---|
Unrolling, once per script with macros | BASE per substituted instruction and visited reference + WRITE(unrolled length) | 100 references to a body of 10 OP_NOPs, unrolled to 1,000 bytes | 337,800 |