A scriptPubKey locks each output and the spending input supplies data that makes evaluation succeed. Script is deterministic, non-Turing-complete and consensus-critical; signatures, hashes, timelocks and threshold policies can be composed without a central adjudicator.
Bitcoin’s deliberately limited stack language for defining conditions under which an output may be spent.
A scriptPubKey locks each output and the spending input supplies data that makes evaluation succeed. Script is deterministic, non-Turing-complete and consensus-critical; signatures, hashes, timelocks and threshold policies can be composed without a central adjudicator.
A full node executes the applicable rules and rejects a spend whose stack result, signature or lock condition fails.
Expressiveness is intentionally constrained; opcode rules, standardness policy, script version and output type affect what is valid, relayed or economical.
Use tested descriptors or wallet policies rather than hand-built hex, verify the exact spending paths and preserve scripts plus key origins for recovery.
Script is deliberately constrained and stack-based; it is not a general smart-contract virtual machine.
For the clearest picture, read this entry together with Transaction, Multisig, Timelock, Taproot. The reverse links also lead from Cryptographic hash, SHA-256, Timelock, Output Descriptor.