← Back to Glossary

Bitcoin Script

Bitcoin Script is the programming language that defines the conditions under which bitcoin can be spent. It is a stack-based language of roughly 100 active operation codes, deliberately not Turing complete: it has no loops, so every script provably terminates, and its cost is bounded before execution.

Why it matters

Script is why bitcoin is programmable money rather than a fixed payment rail. Multisignature custody, timelocked inheritance plans, Lightning Network channels, and atomic swaps are all Script constructions. Its restraint is a design choice with a history: after early vulnerabilities, Satoshi Nakamoto disabled dozens of opcodes in 2010, and the language has been extended only cautiously since. The limited expressiveness bounds what attackers and bugs can do, in deliberate contrast to blockchains with general-purpose virtual machines and their long record of exploited contracts.

How it works

Every output carries a locking script stating its spending conditions, and every input supplies the data that satisfies them, typically signatures and public keys. Validation concatenates the two conceptually: the unlocking data is pushed onto a stack, the locking script executes against it, and the spend is valid only if execution finishes with a true value on top. Upgrades have layered new capability onto this model, from pay-to-script-hash in 2012 through SegWit in 2017 to Taproot's key and script paths in 2021, each preserving the rule that old nodes still validate what they understand.

Ready to convert your gold to Bitcoin?

Get Your Free Kit →