TeachMeBitcoin

Legacy vs. SegWit ScriptSig

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Legacy vs. SegWit ScriptSig

One of the biggest changes in Bitcoin's history was the introduction of Segregated Witness (SegWit). This upgrade fundamentally changed where "Unlocking Data" is stored.

1. Legacy (Pre-SegWit)

In legacy transactions (Addresses starting with 1), all signature and public key data is stored directly in the ScriptSig field of the input.

2. SegWit (Native)

In Native SegWit transactions (Addresses starting with bc1q), the ScriptSig field is empty.

3. SegWit (Nested/P2SH)

In Wrapped SegWit transactions (Addresses starting with 3), the ScriptSig is not empty.

4. Comparison Table

Feature Legacy (P2PKH) SegWit (P2WPKH)
ScriptSig Size ~106 Bytes 0 Bytes
Witness Size N/A ~106 Bytes
TXID Impact Signature changes TXID Signature does NOT change TXID
Address Type Starts with 1 Starts with bc1q

[!NOTE] Even though SegWit makes ScriptSig empty for most transactions today, the protocol still requires the field to exist for backward compatibility.

In the final section, we will build a Python ScriptSig Decoder to extract raw signature data.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!