Bitcoin Script

Bitcoin uses a special, minimalist programming language called Script to process transactions. Unlike many other programming languages, Script isn’t Turing complete—it deliberately leaves out features like loops. This limitation prevents scripts from overloading the network’s resources or causing endless computations, making the system safer and more reliable.

The primary function of Script is to specify how bitcoin can be spent. Every Bitcoin transaction includes a script that sets the rules for unlocking the coins—essentially, who is permitted to use them next. Most transactions use a standard type called Pay-to-Public-Key-Hash (P2PKH), which sends bitcoin to a specific address. However, Script can also handle more advanced requirements, such as multisig addresses, which require approval from several different users’ private keys.

Script isn’t designed for building apps or running complex programs. Its straightforward nature lowers the risk of bugs and losses, making it easier for developers to create secure wallets and payment solutions.

Newer script types like P2WPKH and P2WSH, introduced with SegWit to reduce transaction fees, have been available since 2017, but traditional types like P2PKH still dominate Bitcoin’s blockchain. As of April 2021, over 70% of unspent transaction outputs (UTXOs) use the older P2PKH script. For a visual breakdown of script usage, see the data from Clark Moody’s Dashboard.