WARNING: This chapter is awaiting the writing of chapter 12+
8.5: Spending a P2SH Transaction
NOTE: This is a draft in progress, so that I can get some feedback from early reviewers. It is not yet ready for learning.
Before we close out this overview of P2SH transactions, we're going to touch upon how to spend them.
Use the Redeem Script
As we saw in §6.2: Spending a Transaction to a Multisig, spending a P2SH transaction is all about having that serialized version of the locking script, the so-called redeemScript. So, the first step in being able to spend a P2SH transaction is making sure that you save the redeemScript before you give out the P2SH address to everyone.
Collect Your Variables
Because P2SH addresses aren't integrated into
bitcoin-cli there will be no short-cuts for P2SH spending like you saw in §6.3: Sending an Automated Multisig. You're going to need to collect all the more complex variables on your own!
[[Notes: Example of saving redeemScript, recipient, keys, and scriptPubKey.]]
Create the Transaction
[Notes: I think this is just the same as what we did in chapter 6.2, but I need to actually receive a P2SH transaction to test it, and that requires first getting to the APIs, then using one to send myself a P2SH transaction, then writing up how to respend that.]
Summary: Spending a Transaction with a Bitcoin Script
[Notes: Say it's just like respending that multisig, the hard way]
Advance through "Bitcoin Scripting" with Chapter Nine: Empowering Timelock with Bitcoin Scripts.