I'm studying P2SH, and I want to create a custom script. I already created one tx but without OP_CHECKMULITISIG as you can check at this link https://tbtc.bitaps.com/c86e443bdb3ad4845b1670a63376daf785eae3932a1b6146a7138ea46d51d24a. The script is very simple, in Scriptpubkey you can find
OP_3 OP_EQUAL
And in ScriptSig I put
OP_3
The whole script is:
02000000014ad2516da48e13a746611b2a93e3ea85f7da7633a670165b84d43adb3b446ec8000000000453025387ffffffff029f0f0000000000001976a914261216d05727044e927c385aa9bd278754cdc8dc88ac0000000000000000136a11636f72736f626974636f696e2e636f6d0a00000000
Now, I want to add 2-3 into simple script. My redeem script is:
53875221"$PB1"21"$PB2"21"$PB3"53AE
where $PB1 $PB2 $PB3 are compressed public keys.
Then I try to sign the transaction and add OP_3 in ScriptSig (increase its length by 1 byte)
Original Transaction Data
02000000014218ce881112706b0736419eef81220255d8dcc1412233a47091b770534f9b47000000006d4c6b538752210319ea83d5ab6d737133c6dad6a4f942a87d3f0e7b6ad4050d245c34103319a1c3210211ebc7feb791c8936c7a8d3661bbb54470ecf579fd008d279cda67fc3e7374c721023dfba960bd3b37e004e34cd7777b9b402fb95d145d2649c3adfd5a93411c2c3453aeffffffff025044042a010000001976a91475704b43283de0bdca419b898250e1916acc9df088ac0000000000000000136a11636f72736f626974636f696e2e636f6d0a00000000
Transaction data with OP_3 in scriptSig
02000000014218ce881112706b0736419eef81220255d8dcc1412233a47091b770534f9b47000000006e534c6b538752210319ea83d5ab6d737133c6dad6a4f942a87d3f0e7b6ad4050d245c34103319a1c3210211ebc7feb791c8936c7a8d3661bbb54470ecf579fd008d279cda67fc3e7374c721023dfba960bd3b37e004e34cd7777b9b402fb95d145d2649c3adfd5a93411c2c3453aeffffffff025044042a010000001976a91475704b43283de0bdca419b898250e1916acc9df088ac0000000000000000136a11636f72736f626974636f696e2e636f6d0a00000000
When I send the transaction I get this error:
error code: -26 error message: mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16)