Pay-to-Script-Hash (P2SH) is a protocol which enables the sender to submit a cryptographic hash of a script, instead of the script itself, to the recipient. In other words, P2SH allows users to send Bitcoins to a so-called address prefix, instead of to a complete Bitcoin address.
The prefix constitutes a partial script which can only be redeemed with a full script matching the supplied hash. This feature makes it easier for users to send and receive complex multi-signature transactions without needing to manually share or distribute information about the transaction’s script prior to sending it.
P2SH enables users to securely execute scripts without having to directly communicate their script sequences. It also enables users to create an alias for their P2SH address and share it easily with the recipient. The use of hash values in the P2SH protocol serves as both a validation check and a security measure.
It ensures that only the intended recipient can redeem the payment as it requires knowledge of the full script – as well as its corresponding hash – which is only held by the sender and receiver. Hashing also improves scalability, since the full script doesn’t need to be included in every transaction.
P2SH is one of several methods available on the Bitcoin platform for automating multi-signature transactions without having to expose what’s contained in the transaction. Its security features provide a high degree of confidence when sending Bitcoin payments.