Block Reference
P2SH_LEGACY
Legacy Family
TYPE 0x0903 · LEGACY FAMILY

P2SH_LEGACY

Legacy P2SH (pay-to-script-hash) wrapped as a typed Ladder Script block. Inner script must be valid Ladder Script conditions — no arbitrary bytes allowed. Closes the P2SH data-embedding surface.

Legacy Invertible
P2SH_LEGACY HASH160 + INNER EVAL Inner script must be valid Ladder Script conditions
FieldData TypeSizeSideDescription
hash160 HASH160 20 B Conditions RIPEMD160(SHA256(preimage)) 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 HASH160 from this data at creation time.
[inner witness] var var Witness Witness fields required to satisfy the inner conditions

Conditions side (in scriptPubKey):

0x0903 0 1 HASH160 · 20B = 26 bytes

Witness side (in input witness):

0x0903 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 HASH160(PREIMAGE) = RIPEMD160(SHA256(PREIMAGE)).
2. Compare computed hash to committed HASH160. 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 HASH160 or PREIMAGEERROR
HASH160 wrong size (not 20B)ERROR
HASH160(PREIMAGE) != committed hashUNSATISFIED
PREIMAGE fails to deserialize as Ladder conditionsERROR
Inner conditions evaluation failsUNSATISFIED
Recursion depth > 2ERROR
Inner conditions satisfiedSATISFIED
Conditions (scriptPubKey)
{
  "type": "P2SH_LEGACY",
  "inverted": false,
  "fields": [
    { "type": "HASH160", "hex": "89abcd...20 bytes" }
  ]
}
Witness (input)
{
  "type": "P2SH_LEGACY",
  "inverted": false,
  "fields": [
    { "type": "PREIMAGE", "hex": "01020304...serialised Ladder conditions" },
    { "type": "PUBKEY", "hex": "02abc1...33 bytes" },
    { "type": "SIGNATURE", "hex": "e5f6a7...64 bytes" }
  ]
}
Anti-Spam Script Wrapping
Wraps legacy P2SH but requires inner script to be valid Ladder conditions. No arbitrary data.
Nested Conditions
Inner Ladder conditions can contain any block type, enabling complex spending policies behind a hash commitment.
← P2PKH_LEGACY P2WPKH_LEGACY →