Definition
Bitcoin Script is the small, stack-based programming language that Bitcoin uses to express the conditions for spending coins. It resembles Forth: instructions push data and operations onto a stack and consume them in sequence. Crucially, it is intentionally not Turing-complete — it has no loops or arbitrary jumps. This restriction makes script execution predictable and bounded, which greatly simplifies the network's security model and prevents a malicious script from running forever.
Locking and unlocking scripts
Every spendable output carries a locking script (historically the scriptPubKey) that sets the conditions for spending it. To spend the coins, the new transaction supplies an unlocking script (the scriptSig, or a witness in modern transactions) that satisfies those conditions. At validation, the node runs the combined program starting from the unlocking input; the spend succeeds only if execution completes without failure and leaves a true (non-zero) value on top of the stack. Common patterns include pay-to-public-key-hash and multisignature scripts.
Evolution of the language
Script has been extended carefully over time. SegWit moved unlocking data into the witness, fixing transaction malleability; Taproot introduced Tapscript and Schnorr signatures, improving privacy and efficiency for complex spending conditions. Proposed additions such as new covenant opcodes would further expand what Script can express, always through a backward-compatible consensus change.
Script is built from individual opcodes, and higher-level tools like Miniscript make writing correct scripts more tractable. See also Taproot.
In Simple Terms
Bitcoin Script is the small, stack-based programming language that Bitcoin uses to express the conditions for spending coins. It resembles Forth: instructions push data and…
