I'm trying to redeem a 2of2 p2sh unspent output. I have the complete multisig redeem script, a single input and a single p2pkh output.

My understanding is that I should replace the ScriptPubKey of that single input with the unhashed redeemscript, serialize the Tx with SigHashAll at the end, and sign it with each of the required public keys.

This should yield an input with a signed ScriptPub of OP_0 [Sig][Sig][RedeemScript]. However, this fails to yield a valid signature. I'm using compressed keys in the redeemscript.

Each Sig is of the form OP_PUSHDATA/Size+1[DER encode Signature]

Is there something else particular about the way the transaction needs to be serialized and signed? Should I only be using uncompressed keys?


I solved this, redeemscript wasn't prefixed with pushdata which is necessary as the whole script gets pushed.

  • Congratulations then. You can now accept your answer. – knaperek Sep 7 '14 at 18:54
  • Hmm I did the same mistake. So u guess my coins are stuck in the bad p2sh address.. Testnet coins. – Jus12 Dec 22 '17 at 7:02

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.