O'Reilly logo

Mastering Bitcoin, 2nd Edition by Andreas M. Antonopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Transaction Script Language Operators, Constants, and Symbols

Note

Tables and descriptions sourced from https://en.bitcoin.it/wiki/Script.

Table B-1 shows operators for pushing values onto the stack.

Table B-1. Push value onto stack
Symbol Value (hex) Description

OP_0 or OP_FALSE

0x00

An empty array is pushed onto the stack

1-75

0x01-0x4b

Push the next N bytes onto the stack, where N is 1 to 75 bytes

OP_PUSHDATA1

0x4c

The next script byte contains N, push the following N bytes onto the stack

OP_PUSHDATA2

0x4d

The next two script bytes contain N, push the following N bytes onto the stack

OP_PUSHDATA4

0x4e

The next four script bytes contain N, push the following N bytes onto the stack

OP_1NEGATE

0x4f

Push the value “–1” onto the stack

OP_RESERVED

0x50

Halt - Invalid transaction unless found in an unexecuted OP_IF clause

OP_1 or OP_TRUE

0x51

Push the value “1” onto the stack

OP_2 to OP_16

0x52 to 0x60

For OP_N, push the value “N” onto the stack, e.g., OP_2 pushes “2”

Table B-2 shows conditional flow control operators.

Table B-2. Conditional flow control
Symbol Value (hex) Description

OP_NOP

0x61

Do nothing

OP_VER

0x62

Halt—Invalid transaction unless found in an unexecuted OP_IF clause

OP_IF

0x63

Execute the statements following if top of stack is not 0

OP_NOTIF

0x64

Execute the statements following if top of stack is 0

OP_VERIF

0x65

Halt—Invalid transaction

OP_VERNOTIF

0x66

Halt—Invalid transaction

OP_ELSE

0x67

Execute only ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required