Manually create a transaction to spend the output of a P2SH tx

0

I want to manually create a transaction to spend the output of a P2SH tx, but I don't know where the redeem script should be placed in the new transaction? I followed an online tutorial Building a Transaction By Hand

In order to sign the transaction, you need to build this tx message as the picture shows. But when there is a redeem script, where should i put this redeem script?

 Transaction Message That Will Be Signed

Xiaoyang Zhu Simon Zhu

Posted 2018-09-18T07:16:32.143

Reputation: 21

Answers

0

The redeem script is part of the scriptSig for the input you are trying to spend. Here is the format for a P2SH transaction:

scriptPubKey: OP_HASH160 <scriptHash> OP_EQUAL 
scriptSig: ..signatures... <serialized script>

The script is hashed and compared with the script hash in the scriptPubKey.

JBaczuk

Posted 2018-09-18T07:16:32.143

Reputation: 6 172