The stack is the computer.
Bitcoin Script is a stack-based language. Every transaction you've ever sent was validated by a tiny program running on a machine with no loops, no variables — just a stack. This course teaches you to read, write, and reason about it.
Try it now
Space to stepThis is a real Bitcoin Script interpreter. Step through the opcodes and watch the stack evolve.
↑ top of stack
nothing here yet
press Step or Run to push an item
Free exploration
Open Playground
All 40+ opcodes, drag-and-drop script builder, live stack machine.
Eight modules. One machine.
The Stack
Bitcoin Script runs on a stack — a last-in, first-out data structure with no variables, no loops, and no heap. Master push, pop, and the five fundamental stack manipulation opcodes.
Arithmetic
Script integers use CScriptNum, a variable-length encoding where zero is the empty byte array. Learn addition, subtraction, negation, and range checks.
Comparison
Equality and ordering opcodes let scripts assert conditions without branching. Understand the difference between byte equality and numeric equality.
Branching
OP_IF and OP_NOTIF give Script its only form of conditional execution. See how HTLCs in the Lightning Network depend on exactly this mechanism.
Crypto Primitives
Bitcoin embeds five hash functions directly in Script. Learn SHA-256, HASH256, RIPEMD-160, and HASH160 — the building blocks of every address.
Signatures
OP_CHECKSIG is what makes Bitcoin ownership meaningful: only the holder of a private key can produce a valid signature. Understand ECDSA verification without the math.
P2PKH
Pay-to-Public-Key-Hash is the script behind every address starting with '1'. Trace all six opcodes and understand why the public key is hashed before going on-chain.
Multisig
OP_CHECKMULTISIG enables shared custody: M of N keyholders must sign. Learn the historical dummy-element bug and how 2-of-3 secures exchange cold storage today.