We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Pay to script hash
P2SHLocks to the hash of a script, which the spender reveals. Retired from Bitcoin at the Genesis upgrade.
What it is
A P2SH output holds the hash of a script, not the script itself. From 2012, a spender showed the matching script and met its conditions, and nodes ran that script as an extra step. Since the Genesis upgrade in 2020, nodes no longer take that extra step for new outputs, so this shape only checks the hash.
Script pattern
-
OP_HASH160Hashes the script the spender supplies. -
<script hash>20 bytes: the hash the script must match. -
OP_EQUALSucceeds only when the two hashes match.
23 bytes in all.
How it is spent
Before Genesis: the script's own unlock data, then the script. After it: the bytes that hash to the value in the lock.
Background
BIP 16 added P2SH in 2012, so that multisig and other long scripts could fit behind a short address. Genesis restored the original script rules at block 620,538, and P2SH was retired with that change. Outputs created before Genesis still spend by the old rule.
On chain
Examples coming. They come from the blocks we have typed, and no typed block holds one yet.
Specification
- BIP 16
- /api/v1/types/p2sh
- /api/v1/txs?type=p2sh every stored tx of this type, newest first, with an API key or signed in.