Pay-to-Script-Hash (P2SH): Definition and How Script-Based Bitcoin Transactions Work
Pay-to-Script-Hash (P2SH) is a Bitcoin transaction format that locks funds to the hash of a redeem script instead of directly to a public key or public key hash. This allows Bitcoin to support more complex spending conditions—such as multisignature wallets and custom scripts—while keeping receiving addresses simple and easy to share.
Pay-to-Script-Hash (P2SH) Explained in Simple Terms
Most Bitcoin transactions require only one private key to spend funds.
However, some situations require more advanced rules. For example:
a company may require approval from multiple executives
an escrow transaction may require signatures from different parties
a smart contract may include time-based spending conditions
Before P2SH, the entire script had to be shared with the sender before funds could be received.
P2SH simplified this process.
Instead of sending the complete script, the recipient shares only a Bitcoin address that represents the hash of the script. The full script is revealed only when the funds are eventually spent.
This makes complex transactions much easier to use while preserving Bitcoin's scripting flexibility.
How Pay-to-Script-Hash (P2SH) Works
P2SH separates the process of receiving Bitcoin from revealing the spending conditions.
The process works as follows:
Redeem Script Created
A script containing the spending rules is generated.Script Hashed
The redeem script is hashed.P2SH Address Generated
The script hash becomes a Bitcoin address.Funds Received
Bitcoin is sent to the P2SH address.Funds Spent
When spending the Bitcoin, the original redeem script and the required unlocking data are provided.
The spending model can be summarized as:
Bitcoin nodes verify that the revealed script matches the stored hash and that all spending conditions have been satisfied.
Example of Pay-to-Script-Hash (P2SH) in Practice
Suppose three business partners share a Bitcoin treasury.
They create a 2-of-3 multisignature redeem script requiring any two partners to approve a payment.
Rather than giving customers the entire script, they simply provide a P2SH address.
When someone sends Bitcoin:
only the P2SH address is needed
Later, when the partners spend the funds:
the original redeem script is revealed
two valid signatures are provided
Bitcoin nodes verify that the script hash matches the original address
Only then is the transaction accepted.
Why P2SH Matters
P2SH made advanced Bitcoin scripts much more practical.
It allows users to create sophisticated spending policies while keeping receiving addresses short and user-friendly.
P2SH also became the foundation for many important Bitcoin applications, including:
multisignature wallets
escrow services
enterprise custody
early Layer 2 solutions
Without P2SH, these use cases would have been significantly more complicated to deploy.
P2SH Address Format
P2SH addresses are easy to recognize because they begin with:
3
Example:
3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy
These addresses remain widely supported by wallets, exchanges, and payment processors.
P2SH vs P2PKH
P2PKH
Locks Bitcoin to a public key hash.
Typically used for:
standard single-signature wallets
Addresses begin with:
1
P2SH
Locks Bitcoin to a script hash.
Supports:
multisignature wallets
custom scripts
advanced spending conditions
Addresses begin with:
3
P2SH provides much greater flexibility than traditional P2PKH transactions.
P2SH and SegWit
When SegWit was introduced, many wallets adopted P2SH-wrapped SegWit addresses.
This approach allowed users to benefit from SegWit while maintaining compatibility with older wallet software.
In these transactions:
the address still begins with 3
SegWit witness data is used internally
transaction fees are generally lower than legacy P2PKH transactions
Today, many wallets have transitioned to Native SegWit addresses, but P2SH remains an important compatibility layer.
P2SH and Multisignature Wallets
One of the most common uses of P2SH is multisignature security.
For example:
2-of-3 wallet
3-of-5 wallet
corporate treasury approval systems
P2SH made these configurations much easier because the sender only needs a standard-looking Bitcoin address instead of a complex redeem script.
This simplicity contributed to the widespread adoption of multisig wallets.
Is P2SH Still Used?
Yes.
Although newer technologies such as Taproot offer more efficient ways to support complex spending conditions, P2SH remains fully supported by the Bitcoin protocol.
Many existing wallets, exchanges, and businesses continue using P2SH because of its excellent compatibility and long-standing reliability.