Block Reference
P2WSH_LEGACY
Legacy Family
TYPE 0x0905 · LEGACY FAMILY

P2WSH_LEGACY

Legacy P2WSH (pay-to-witness-script-hash) wrapped as a typed Ladder Script block. SHA256 of inner conditions must match. Same pattern as P2SH but with SHA256.

Legacy Invertible
P2WSH_LEGACY SHA256 + INNER EVAL Inner script must be valid Ladder Script conditions
FieldData TypeSizeSideDescription
hash256 HASH256 32 B Conditions SHA256 commitment to the inner script. Node-computed — the user provides PREIMAGE (serialised Ladder Script conditions) and the node computes this field automatically. Raw hash input is rejected.
preimage PREIMAGE var Witness Serialised Ladder Script conditions (the inner script) — provided by the user. The node derives HASH256 from this data at creation time.
[inner witness] var var Witness Witness fields required to satisfy the inner conditions

Conditions side (in scriptPubKey):

0x0905 0 1 HASH256 · 32B = 38 bytes

Witness side (in input witness):

0x0905 0 n PREIMAGE · varB [inner witness fields] = variable
Total (conditions + witness) variable

Witness size depends on the inner Ladder Script conditions and their witness fields.

1. Compute SHA256(PREIMAGE).
2. Compare computed hash to committed HASH256. If mismatch → UNSATISFIED
3. Deserialize PREIMAGE as Ladder Script conditions. If invalid → UNSATISFIED
4. Evaluate inner conditions with remaining witness fields. Result → SATISFIED or UNSATISFIED
ConditionResult
Missing HASH256 or PREIMAGEERROR
HASH256 wrong size (not 32B)ERROR
SHA256(PREIMAGE) != committed hashUNSATISFIED
PREIMAGE fails to deserialize as Ladder conditionsERROR
Inner conditions evaluation failsUNSATISFIED
Recursion depth > 2ERROR
Inner conditions satisfiedSATISFIED
Conditions (scriptPubKey)
{
  "type": "P2WSH_LEGACY",
  "inverted": false,
  "fields": [
    { "type": "HASH256", "hex": "e3b0c4...32 bytes" }
  ]
}
Witness (input)
{
  "type": "P2WSH_LEGACY",
  "inverted": false,
  "fields": [
    { "type": "PREIMAGE", "hex": "01020304...serialised Ladder conditions" },
    { "type": "PUBKEY", "hex": "02abc1...33 bytes" },
    { "type": "SIGNATURE", "hex": "e5f6a7...64 bytes" }
  ]
}
Segwit Script Migration
Same anti-spam pattern as P2SH_LEGACY but using SHA256 hash (matching P2WSH).
Complex Inner Conditions
Inner Ladder conditions with full composability, behind a SHA256 commitment.
← P2WPKH_LEGACY P2TR_LEGACY →