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

1 Answer 1


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.

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.