1

I have a few questions relating to Bitcoin Signatures And P2SH:

Why is P2SH used as opposed to other forms? Is it still prevalent today - has SegWit made it redundant or less useful, if not, what is the most used signature format?

And mainly:

Can the P2SH redeem script consist of a single public key (hence only one person is creating the redeem script). What even is the redeem script?

1 Answer 1

5

Before the adoption of BIP16: Pay to Script Hash, multisig was possible, but only in the form of bare outputs. The multisig would be directly defined in the ScriptPubKey (the output script). This had three disadvantages. There was no address standard for encoding these flexible constructions, the resulting big output script had to be paid for by the sender but was for the benefit of the receiver, and the big output script would also cause the UTXO would be much larger than other UTXOs, which then would need to be stored by all full nodes until it got spent.

BIP16 introduced a level of indirection. Instead of directly encoding the condition script in the ScriptPubKey, the ScriptPubKey contains a P2SH Program which commits to one specific Redeem Script via a hash of it. The ScriptSig (the input script) provides the actual spending conditions in the form of the Redeem Script (matching the hash commitment in the output), and the script arguments to satisfy the Redeem Script.

The Redeem Script can contain any valid Script expression, including one that requires only the signature of a single key to spend. This construction would be less blockspace efficient than using a single-sig output type in the first place, though.

Since the P2SH Program always had a fixed length, it was easy to make an address standard for it, and the cost of the outputs was no longer as burdensome.

enter image description here

About 35% of all transaction outputs today are P2SH outputs with the majority encoding wrapped segwit outputs. We have more blockspace efficient output types now. Using one of P2WPKH, P2WSH, and P2TR it would be able to achieve any equivalent condition script using less blockspace.

4
  • 2
    Another disadvantage was that the sender had to bear (a significant) part of the cost for a decision made by the recipient (to receive coins on a multisig). Jun 30, 2022 at 12:07
  • So who creates the scriptpubkey (unlocking script) and scriptsig (unlocking script). Is it the people who are receiving the Bitcoins or is the people who want to transact the Bitcoins?
    – Jamo
    Jun 30, 2022 at 12:11
  • @AntoinePoinsot: Great point, added
    – Murch
    Jun 30, 2022 at 12:15
  • 2
    @Jamo: The receiver always decides how they'd like to get paid. They then communicate to the sender instructions how to pay them, usually in form of an address. The sender builds the transaction, so while the receiver defines the content of the ScriptPubkey, the sender creates it.
    – Murch
    Jun 30, 2022 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.