-
Notifications
You must be signed in to change notification settings - Fork 24
Example Scripts
Kefkius edited this page Sep 5, 2015
·
1 revision
These are some illustrative scripts to help those unfamiliar with Bitcoin scripts get started. Try copying these into your script editor and evaluating them in the Stack Evaluator.
Note: Whitespace does not matter. It's only in the following scripts for illustrative purposes.
This script will push 02
and 05
onto the stack, then add them, resulting in 07
.
0x02 0x05 OP_ADD
This script will push '07' to the stack twice. Then it will push the number of stack items (2) to the stack.
0x07 OP_DUP OP_DEPTH
This script will push 1
to the stack if the first item is greater than five. Otherwise, it will push 0
. Change 0x02
to 0x06
and the result will change from 0
to 1
.
0x02 0x05 OP_SUB 0x00 OP_GREATERTHAN
OP_IF
0x01
OP_ELSE
0x00
OP_ENDIF