Bitcoin Script
Execute locking conditions one opcode and stack item at a time.
Follow these 10 lessons in order, or choose the topic you need. Each lesson combines an explanation, a worked example and practice inside the Guild.
Stack-machine execution
Script is a deliberately constrained stack language whose success depends on final truth and consensus limits.
35 minutes · Open lessonPushes, arithmetic, and control flow
Data pushes, numeric encodings, conditionals, and verification opcodes compose spending policies.
45 minutes · Open lessonSignature checks and sighashes
CHECKSIG validates a signature over a transaction digest selected by a sighash mode.
55 minutes · Open lessonP2PKH and P2SH
Legacy templates separate address-friendly commitments from revealed spending scripts.
65 minutes · Open lessonWitness programs
SegWit moves authorization data into witness structures and versions the program semantics.
35 minutes · Open lessonMultisig and policy composition
Multiple keys, timelocks, and hashlocks can form recovery, escrow, and channel policies.
45 minutes · Open lessonScript limits and malleability
Disabled opcodes, resource limits, encoding rules, and malleability protections constrain safe composition.
55 minutes · Open lessonScript debugging
Experts trace every stack transition, identify the failing predicate, and distinguish malformed witnesses from false conditions.
65 minutes · Open lessonP2PK, P2PKH, P2MS, P2SH, and OP_RETURN
Compare the exact assembly, serialized bytes, spend data, standard uses, and failure boundary for Bitcoin's classic Script templates.
35 minutes · Open lessonNative and nested SegWit scripts
Construct P2WPKH, P2WSH, P2SH-P2WPKH, and P2SH-P2WSH outputs and follow each redeem, witness, hash, and signature check.
45 minutes · Open lesson