TeachMeBitcoin

Nested vs. Native SegWit (P2SH vs. Bech32)

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Nested vs. Native SegWit (P2SH vs. Bech32)

When SegWit was first released, the Bitcoin ecosystem faced a challenge: many older wallets didn't recognize the new address format. To solve this, two different ways of using SegWit were created: Nested and Native.

1. Nested SegWit (P2SH)

2. Native SegWit (Bech32)

3. The "Anyone-Can-Spend" Mechanism

Both formats use a special type of script that old nodes see as "Anyone-Can-Spend."

4. Witness Versioning

SegWit introduced a "Version Byte" (starting at 0).

Type Address Encoding Fee Savings
Legacy 1... Base58 0%
Nested 3... Base58 ~20%
Native bc1q... Bech32 ~40%

In the final section, we will build a Python SegWit Auditor.

☕ 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!