Efficiency and Privacy
P2SH: Efficiency and Privacy
P2SH was more than just a convenient address format; it was a fundamental shift in how Bitcoin scales. By allowing complex scripts to be represented as simple 20-byte hashes, P2SH introduced major improvements to the network's economics and privacy.
1. Saving the UTXO Set
The UTXO Set is the most critical database in a Bitcoin node because it must be kept in RAM for fast verification.
-
Without P2SH: A 2-of-3 multisig output takes up ~105 bytes of space in the UTXO set.
-
With P2SH: Every multisig output takes up exactly 20 bytes of hash data. By moving the large public keys and script logic into the Input (which is not stored in the UTXO set permanently), P2SH reduced the storage burden on full nodes.
2. Sender-Receiver Equality
In the legacy model, if you wanted to receive a multisig payment, you had to ask the sender to pay higher fees (because their transaction was larger). This was unfair to the sender.
-
P2SH makes every output the same size. The sender pays a standard fee.
-
The receiver pays the "Weight" fee when they choose to spend the coins later.
3. Privacy and Script Blinding
P2SH provides "Blinded" scripts.
-
If you have a business wallet where you require a lawyer, a CEO, and a CFO to sign (2-of-3), you don't necessarily want the world to know your internal organizational structure.
-
With P2SH, nobody knows it is a 2-of-3 multisig until the day you spend it. If you never spend the coins, the script is never revealed.
4. Standardness Thresholds
P2SH allowed the network to support more complex scripts without relaxing "Standardness" rules. While bare multisig is limited to 3 keys, P2SH allows for up to 15 keys (limited by the 520-byte script size limit).
| Property | P2MS (Bare) | P2SH (Hashed) |
|---|---|---|
| UTXO Impact | High | Low |
| Fee Responsibility | Sender | Receiver |
| Privacy | Zero | High (until spend) |
| Standardness | Strict (3 keys) | Flexible (15 keys) |
In the final section, we will build a Python P2SH Auditor.
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: