River Intelligence

Sign up for our curated weekly newsletter delivering exclusive market insights to your inbox.

Invest in Bitcoin.

Human Support

Track Performance

Recurring Buys

P2SH


Pay-to-Script-Hash (P2SH) is a type of ScriptPubKey which allows for the spending of bitcoin based on the satisfaction of the script whose hash is specified within the transaction. A P2SH transaction is a transaction whose inputs were locked using a P2SH ScriptPubKey.

For example, if Alice sends Bob 1 BTC in a P2SH transaction, she includes the hash of the script required to spend the bitcoin in the transaction. This script can require signatures by Bob’s private keys and/or many other qualifications. When Bob wants to spend the bitcoin he has received from Alice, he reconstructs the script whose hash Alice used to send the bitcoin, and signs the transaction with any private keys required by the script.

P2SH is extremely flexible because it allows users to construct arbitrary scripts. P2SH is used to enable backwards compatibility with new transaction types, including SegWit. Additionally, the sender of the transaction does not need to known what script type they are sending to. In the example above, Bob can privately construct his desired script and only send Alice the hash of that script, preserving more privacy for Bob.