TYPE 0x0904 · LEGACY FAMILY
P2WPKH_LEGACY
Legacy P2WPKH (pay-to-witness-pubkey-hash) wrapped as a typed Ladder Script block. Identical evaluation to P2PKH_LEGACY — HASH160 check + signature verify. Represents the segwit migration path.
Legacy Non-InvertibleLadder Diagram
Fields
| Field | Data Type | Size | Side | Description |
|---|---|---|---|---|
| hash160 | HASH160 | 20 B | Conditions | RIPEMD160(SHA256(pubkey)) commitment. Node-computed — the user provides PUBKEY and the node computes this field automatically. Raw hash input is rejected. |
| pubkey | PUBKEY | 32-33 B | Witness | Public key — provided by the user. The node derives HASH160 from this key at creation time. Revealed at spend time. |
| signature | SIGNATURE | 64-65 B | Witness | Signature over the transaction sighash |
Wire Format Breakdown
Conditions side (in scriptPubKey):
0x0904
0
1
HASH160 · 20B
= 26 bytes
Witness side (in input witness):
0x0904
0
2
PUBKEY · 33B
SIGNATURE · 64B
= 105 bytes
Total (conditions + witness)
131 bytes
With rung overhead included. Compressed pubkey (33B) case.
Evaluation Logic
1.
Delegates to
EvalP2PKHLegacyBlock directly — the wrapper exists only to give P2WPKH a distinct block-type ID. Field, hash, and sig semantics are byte-identical to P2PKH_LEGACY.
2.
Locate HASH160, PUBKEY, SIGNATURE; any missing → ERROR. HASH160 not exactly 20 B → ERROR
3.
Compute CHash160(PUBKEY);
memcmp mismatch → UNSATISFIED
4.
Dispatch VerifySigWithScheme via the Ladder
LadderSigChecker; result is the block result.
Return Values
| Condition | Result |
|---|---|
| Missing HASH160, PUBKEY, or SIGNATURE | ERROR |
| HASH160 wrong size (not 20B) | ERROR |
| HASH160(PUBKEY) != committed hash | UNSATISFIED |
| Signature fails | UNSATISFIED |
| Signature valid | SATISFIED |
JSON Wire Format
Conditions (committed in the rung leaf)
{
"type": "P2WPKH_LEGACY",
"inverted": false,
"fields": [
{ "type": "HASH160", "hex": "89abcd...20 bytes" }
]
}Witness (input)
{
"type": "P2WPKH_LEGACY",
"inverted": false,
"fields": [
{ "type": "PUBKEY", "hex": "02abc1...33 bytes" },
{ "type": "SIGNATURE", "hex": "e5f6a7...64 bytes" }
]
}Notes
- Functionally identical to P2PKH_LEGACY.
- The HASH160 field is node-computed: the user supplies PUBKEY and the node derives the hash commitment automatically. Submitting a raw HASH160 value directly is rejected.
- Kept as a separate type code to represent the distinct segwit migration path.
- In Bitcoin, P2WPKH moved witness data outside the transaction body for fee savings. In Ladder Script, the distinction is semantic only.
Use Cases
Segwit Migration Path
Represents the SegWit P2WPKH migration. Identical evaluation to P2PKH_LEGACY.
Witness Discount Compatibility
Maintains the conceptual distinction from P2PKH for users migrating from segwit outputs.