Pay to script hash: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Luke-jr (talk | contribs)
remove irrelevant and false information
Evoskuil (talk | contribs)
m →‎History: fix bip9 url
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
'''342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey''' is a Bitcoin [[address]] notable for being the first [[P2SH]]-compatible address receiving bitcoins on the production network.
{{infobox miner activated fork|title=Pay to Script Hash
|bipnumber=[[BIP_0016|BIP 16]]
|purpose=Allow the recipient of a transaction to specify the redeem script instead of the sender
|coinbase=/P2SH/
|starttime=2012-03-08 00:00:00
|timeout=2012-03-15 00:00:00
|supermajority=55%
|activated=Block #173805<br/>2012-04-01 00:00:00
}}'''Pay to script hash''' (P2SH) transactions were standardised in [[BIP 0016|BIP 16]]. They allow transactions to be sent to a script hash ([[address]] starting with 3) instead of a public key hash (addresses starting with 1). To spend bitcoins sent via P2SH, the recipient must provide a [[script]] matching the script hash and data which makes the script evaluate to true.


[[Category:Notable addresses]]
Using P2SH, you can send bitcoins to an address that is secured in various unusual ways without knowing anything about the details of how the security is set up. You just send bitcoins to the ~34-character P2SH address. The recipient might need the signatures of several people to spend these bitcoins, or a password might be required, or the requirements could be completely unique.
 
== Addresses ==
 
[[BIP 0013|BIP 13]] specifies the address format. Bitcoin P2SH addresses always start with <code>3</code>.
 
== Example ==
 
Transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 paid to P2SH address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG.  You can see the redeem script in transaction 7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45 which spends that output, using <code>OP_FALSE <sig> { OP_1 <pubkey> OP_1 OP_CHECKMULTISIG }</code>.
 
== History ==
 
The first activation window failed and another was set to be active on 1 April 2012, in v0.6.0rc2<ref>[https://github.com/bitcoin/bitcoin/commit/46aa2a6bdd5ec512dd2e364b298e6e73c3e61354 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>[https://bitcointalk.org/index.php?topic=63165.msg788832#msg788832 bitcointalk topic 63165]</ref> when an invalid transaction according to their nodes was mined. Later soft fork activation techniques, such as [[BIP 0034|BIP 34]] and [[BIP 0009|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>[https://blog.bitmex.com/bitcoins-consensus-forks/ 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>[https://github.com/bitcoin/bitcoin/commit/8f188ece3c82c4cf5d52a3363e7643c23169c0ff 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 0016|BIP 16]], so it's not a good example to understand P2SH.
 
==References==

Latest revision as of 23:34, 30 December 2017

Pay to Script Hash
BIP numberBIP 16
TypeMiner-activated softfork
PurposeAllow the recipient of a transaction to specify the redeem script instead of the sender

Deployment

CB signature/P2SH/
Starttime2012-03-08 00:00:00
Timeout2012-03-15 00:00:00
Supermajority55%
ActivatedBlock #173805
2012-04-01 00:00:00

Pay to script hash (P2SH) transactions were standardised in BIP 16. They allow transactions to be sent to a script hash (address starting with 3) instead of a public key hash (addresses starting with 1). To spend bitcoins sent via P2SH, the recipient must provide a script matching the script hash and data which makes the script evaluate to true.

Using P2SH, you can send bitcoins to an address that is secured in various unusual ways without knowing anything about the details of how the security is set up. You just send bitcoins to the ~34-character P2SH address. The recipient might need the signatures of several people to spend these bitcoins, or a password might be required, or the requirements could be completely unique.

Addresses

BIP 13 specifies the address format. Bitcoin P2SH addresses always start with 3.

Example

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[1]. Users running v0.6.0rc1 who did not upgrade for the delay, activated early and got stuck on block 170,060[2] 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[3]. 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[4].

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