What Is Bitcoin Script and How Does It Enable Smart Contracts?
By Kurt Wuckert Jr.
Bitcoin Script is a simple but powerful programming language that enables smart contracts. It powers everything from multi-signature wallets to complex conditional payments.
Bitcoin Script is intentionally simple. It is not Turing-complete (no loops), which prevents infinite computation. This design choice trades flexibility for security and predictability.
How Script Works
Stack-Based Execution
Bitcoin Script uses a stack machine. Operations push and pop values from a stack. The final result determines if a transaction is valid or invalid.
Example: OP_DUP (duplicate top item) → OP_HASH160 (hash twice) → [expected hash] → OP_EQUAL (check equality)
Common Use Cases
Multi-Signature Wallets
Require multiple private keys to spend. Example: 2-of-3 means two of three keys can authorize spending.
Timelocks
Coins can be locked until a specific time or block height. Used for vesting schedules or delayed payments.
Hash Locks
Coins are locked by a hash puzzle. Whoever knows the preimage can unlock them. Enables atomic swaps.
Bitcoin Script proves that you don't need Turing-completeness to enable sophisticated contracts. Simplicity is a feature, not a bug.