Skip to Content
Mastering Bitcoin, 2nd Edition
book

Mastering Bitcoin, 2nd Edition

by Andreas M. Antonopoulos
June 2017
Beginner to intermediate
411 pages
11h 3m
English
O'Reilly Media, Inc.
Content preview from Mastering Bitcoin, 2nd Edition

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Bitcoin, 3rd Edition

Mastering Bitcoin, 3rd Edition

Andreas M. Antonopoulos, David A. Harding
Mastering Bitcoin

Mastering Bitcoin

Andreas M. Antonopoulos
The Bitcoin Standard

The Bitcoin Standard

Saifedean Ammous
Grokking Bitcoin

Grokking Bitcoin

Kalle Rosenbaum

Publisher Resources

ISBN: 9781491954379Errata Page