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 ...

Get Mastering Bitcoin, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.