0

I have created a P2SH address, funded it, and am attempting to move the funds with a TX.

The redeemScript for the TX requires the TX signature (OP_CHECKSIGVERIFY), but in order to create this signature, the TX preImage must be created and hashed. However, the preImage for a P2SH contains the TX redeemScript itself...this seems to create a loop wherein this functionality is not possible.

Am I doing something incorrectly, or am I overthinking things?

1

You might want to review BIP16 (pay to script hash) https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki

The signature is not included in the redeem script, typically just the public key. (Your script could be anything, all I know is it has a CHECKSIGVERIFY in it, so I'm answering broadly...)

The INPUT SCRIPT aka scriptSig of the transaction SPENDING from the P2SH output would then need to contain the signature and the entire serialized redeem script (the preimage to the script hash in the output).

  • After more reading, it looks like the redeemScript is the serialized script of the spending TX...and after dumping some variables, looks like my underlying issue is an incomplete preImage. – circusdei Jul 22 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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