Stack-machine execution
Terms used in this lesson
- OP_ADD
- A Bitcoin Script operation that removes two script numbers and pushes their sum.
- OP_EQUAL
- A Bitcoin Script operation that compares two byte strings and pushes true or false.
- Witness
- Signatures, scripts, or other data supplied to satisfy a Bitcoin output’s spending condition.
- OP_VERIFY
- A Bitcoin Script operation that consumes a value and immediately fails if it is false.
- SegWit
- Segregated Witness: a Bitcoin upgrade that separates authorization data from the transaction identifier and introduces versioned witness programs.
- Tapscript
- The version of Bitcoin Script used by a Taproot script-path spend.
- UTXO
- Unspent transaction output: one discrete chunk of bitcoin that can be used as a transaction input.
Script is a deliberately constrained stack language whose success depends on final truth and consensus limits.
Loading lesson visuals...
Learn the idea
Bitcoin Script is a stack-based language for evaluating whether a transaction input satisfies the output it spends. A stack is a last-in, first-out list of byte strings. An opcode is an instruction that pushes, removes, compares, or verifies stack items. The applicable Script rules succeed only when execution finishes without error and with the required true result.
Load unlocking data
For modern outputs, witness items are placed on the initial stack in their serialized order under the witness-program rules.
Inspect every idea above to open it.
The output commits a condition. The relevant script is evaluated later by validating nodes when a transaction attempts to spend that output.
The questions unlock after every required learning activity
Inspect every guided idea, open the worked example, rebuild its mechanism, and complete the deterministic lesson tool. Your progress is saved automatically.