TeachMeBitcoin

P2SH Overview

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

P2SH: Pay-to-Script-Hash (The "3" Addresses)

P2SH (Pay-to-Script-Hash), defined in BIP 16, was a revolutionary upgrade to the Bitcoin protocol. It moved the responsibility of defining complex spending conditions from the sender to the receiver. This enabled the creation of shorter, standardized addresses that start with the number 3.

1. The Complexity Shift

Before P2SH, if you wanted someone to pay into a 2-of-3 multisig account, you had to give them a massive raw script containing all the public keys.

2. Hiding the "Redeem Script"

The actual logic (like "Needs 2 of 3 signatures") is called the Redeem Script.

3. Standardized Addresses

P2SH introduced a new address format using Base58Check with a version byte of 0x05.

4. Backward Compatibility

P2SH was a "Soft Fork." Old nodes that didn't understand P2SH simply saw the output as a "Pay to a hash" script. They didn't know they were supposed to verify the Redeem Script, but new nodes did, ensuring the network remained secure.

Feature P2MS (Bare) P2SH (Hashed)
Address Prefix None 3
Privacy Public keys visible immediately Public keys hidden until spend
Sender Fee High (for multisig) Low (Standard size)
Standardness Limited to 3 keys Supports up to 15 keys (Standard)

In the next section, we will analyze the ScriptPubKey Structure of P2SH.

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