P2SH

DISCLAIMER

This page is a direct copy of https://en.bitcoin.it/w/Pay_to_script_hash and may require extensive editing



Pay to script hash (P2SH) transactions were designed to allow funds to be locked with a script hash. To spend bitcoins locked in a P2SH output, the recipient needed to possess a script matching the script hash and a corresponding set of data which could solve the puzzle.

P2SH was created after limits and transaction standardisation requirements were introduced that limited the scope of Bitcoin transactions that could be propagated over the BTC networks to a specific set of templated designs.

P2SH enabled users to create a customised Bitcoin script and hash it into an ~34-character P2SH address. These were most commonly used to manage multisignature wallets that required more than 2 of 3 signature rights as was limited by the isStandard transaction test. Bitcoin P2SH addresses always started with 3.

Deprecation

P2SH was deprecated as part of the BitcoinSV Genesis upgrade in February 2020. P2SH outputs remain spendable under network rules however any attempts to create new P2SH transactions would be rejected, requiring

Transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 paid to P2SH address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG. You can see the redeem script in transaction 7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45 which spends that output, using OP_FALSE <sig> { OP_1 <pubkey> OP_1 OP_CHECKMULTISIG }.

History

The first activation window failed and another was set to be active on 1 April 2012, in v0.6.0rc2<ref>Move BIP16 switchover time to April 1 (gavinandresen)</ref>. Users running v0.6.0rc1 who did not upgrade for the delay, activated early and got stuck on block 170,060<ref>bitcointalk topic 63165</ref> when an invalid transaction according to their nodes was mined. Later soft fork activation techniques, such as BIP 34 and BIP 9, reflect on block history to determine activation (also from miner signaling) in order to prevent this problem.

After activation problems were then caused by the remaining 45% of miners producing invalid blocks for several months<ref>A Complete History of Bitcoin’s Consensus Forks</ref>. Later soft fork activation techniques raised the signaling enforcement threshold from 55% to 95% in order to mitigate this problem.

Testnet activated following its first window, which was two weeks earlier than the first (failed) mainnet window<ref>Remove -bip16 and -paytoscripthashtime command-line arguments (gavinandresen)</ref>.

342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey is a Bitcoin address notable for being the first P2SH-compatible address receiving bitcoins on the production network. Its payment was mined in block 160720; note that it was spent prior to the enforcement of BIP 16, so it's not a good example to understand P2SH.

References