1

Note: This happens with specific input, even though I've used the same code for other inputs and it works.

I have created a raw transaction using the following unspent:

Array
(
    [0] => Array
        (
            [txid] => 108544730bfaeccca0de66eda8546a33403899fb508bee582f1d9e1628ec0695
            [vout] => 1
            [scriptPubKey] => 0014194eef88d8428a4af66177779d0844d66d743e5d
            [amount] => 0.000560
            [address] => tb1qr98wlzxcg29y4anpwame6zzy6ekhg0jadfmrgr
            [redeemScript] => 
        ) // this i'm not able to spend.

    [1] => Array
        (
            [txid] => 5bda1b65ff7cb3c80f09f797debb2bf1749d22332e984ba6377a0c7cac30aed9
            [vout] => 0
            [scriptPubKey] => 00141f09edebd56ffadd0c1834d048c8a416d5418f68
            [amount] => 0.100000
            [address] => tb1qruy7m674dlad6rqcxngy3j9yzm25rrmgm9x3d5
            [redeemScript] => 
        )

)

https://testnet.blockchain.info/tx/108544730bfaeccca0de66eda8546a33403899fb508bee582f1d9e1628ec0695

Created Transaction Hex:

02000000029506ec28169e1d2f58ee8b50fb993840336a54a8ed66dea0ccecfa0b734485100100000000ffffffffd9ae30ac7c0c7a37a64b982e33229d74f12bbbde97f7090fc8b37cff651bda5b0000000000ffffffff02404b4c0000000000160014943a52d24537d96360fb533fdc7183a92963f9c7e8c54c0000000000160014f41ddffe9582cdf5841b332f8f3751f8c1514dd300000000

SignrawTransaction Response:

Array
(
    [hex] => 020000000001029506ec28169e1d2f58ee8b50fb993840336a54a8ed66dea0ccecfa0b734485100100000000ffffffffd9ae30ac7c0c7a37a64b982e33229d74f12bbbde97f7090fc8b37cff651bda5b0000000000ffffffff02404b4c0000000000160014943a52d24537d96360fb533fdc7183a92963f9c7e8c54c0000000000160014f41ddffe9582cdf5841b332f8f3751f8c1514dd302473044022042cb0cd01181cb2ec915bd5d981dbb197d2febb8acfbeae3c653747c8cf2b4b8022001e4ee55c7daa7197b4cd0948f4fb49b7660ecedb96e08e2220422e6485a0591012102b4592cc61c94b91c866ea6201885ce41f0f9cbc4a762c614799dfb854b6e18d50247304402204b475a5a61184aa46d1db9e22797c3084d409fffe608ceedaf3b6af7e2a9c2a002206404b55c0ba8b902d4bd48db115dd7d10befdc3cab57fdb42e2631e31c35070801210387844ba61f400e181004900f1ec59a3b310e4afd9a22d51cc8bc1a6631c057f500000000
    [complete] => 1
)

Sendrawtrasnaction response: 64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)

1
  • I've spent the second input but not the first one.
    – Adam
    Apr 27, 2018 at 5:08

1 Answer 1

2

First of all, these are not P2SH-P2WPKH, these are normal P2WPKH outputs. They are not related to P2SH at all.

The problem here is probably that the amount is incorrect. If you are providing the previous output data yourself, then the amounts is incorrect. You have it as 0.000560 but the actual amount is 0.00055999. Since Segwit commits to the amount in the signature, having the wrong amount means that the signature signrawtransaction creates will be invalid which thus results in this error.

1
  • Thanks for taking time looking into that, I have fixed the amount and it did work.
    – Adam
    Apr 27, 2018 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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