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

<p>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 <code>signrawtransaction</code> creates will be invalid which thus results in this error.</p>

CC BY-SA 3.0
2018-04-27T11:06:53.780Z
Thanks for taking time looking into that, I have fixed the amount and it did work.
Tailer
CC BY-SA 3.0
2018-04-27T05:43:09.153Z
2018-04-27T05:43:09.153Z
Ava Chow
<blockquote>
  <p>Note: This happens with specific input, even though I've used the same
  code for other inputs and it works.</p>
</blockquote>

<p>I have created a raw transaction using the following unspent:</p>

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

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

)
</code></pre>

<p><a href="https://testnet.blockchain.info/tx/108544730bfaeccca0de66eda8546a33403899fb508bee582f1d9e1628ec0695" rel="nofollow noreferrer">https://testnet.blockchain.info/tx/108544730bfaeccca0de66eda8546a33403899fb508bee582f1d9e1628ec0695</a></p>

<p>Created Transaction Hex:</p>

<pre><code>02000000029506ec28169e1d2f58ee8b50fb993840336a54a8ed66dea0ccecfa0b734485100100000000ffffffffd9ae30ac7c0c7a37a64b982e33229d74f12bbbde97f7090fc8b37cff651bda5b0000000000ffffffff02404b4c0000000000160014943a52d24537d96360fb533fdc7183a92963f9c7e8c54c0000000000160014f41ddffe9582cdf5841b332f8f3751f8c1514dd300000000
</code></pre>

<p>SignrawTransaction Response: </p>

<pre><code>Array
(
    [hex] =&gt; 020000000001029506ec28169e1d2f58ee8b50fb993840336a54a8ed66dea0ccecfa0b734485100100000000ffffffffd9ae30ac7c0c7a37a64b982e33229d74f12bbbde97f7090fc8b37cff651bda5b0000000000ffffffff02404b4c0000000000160014943a52d24537d96360fb533fdc7183a92963f9c7e8c54c0000000000160014f41ddffe9582cdf5841b332f8f3751f8c1514dd302473044022042cb0cd01181cb2ec915bd5d981dbb197d2febb8acfbeae3c653747c8cf2b4b8022001e4ee55c7daa7197b4cd0948f4fb49b7660ecedb96e08e2220422e6485a0591012102b4592cc61c94b91c866ea6201885ce41f0f9cbc4a762c614799dfb854b6e18d50247304402204b475a5a61184aa46d1db9e22797c3084d409fffe608ceedaf3b6af7e2a9c2a002206404b55c0ba8b902d4bd48db115dd7d10befdc3cab57fdb42e2631e31c35070801210387844ba61f400e181004900f1ec59a3b310e4afd9a22d51cc8bc1a6631c057f500000000
    [complete] =&gt; 1
)
</code></pre>

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

CC BY-SA 3.0
2018-04-27T05:08:36.167Z
I've spent the [second input](https://testnet.blockchain.info/tx/d58c8c74e2209d7fcbfd0cc7f456b04cc5ee665c183b339f1cf55faf77de4ffc) but not the first one.
Tailer
<transactions><bitcoind><spending><createrawtransaction><sendrawtransaction>
64: non-mandatory-script-verify-flag while broadcasting P2WPKH Bech32 with specific inputs
Tailer
# 64: non-mandatory-script-verify-flag while broadcasting P2WPKH Bech32 with specific inputs

(Asked by: username_0 on 2018-04-27)

> 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)`

**Tags:** transactions, bitcoind, spending, createrawtransaction, sendrawtransaction

> **Comments:**
> **username_0**: I've spent the [second input](https://testnet.blockchain.info/tx/d58c8c74e2209d7fcbfd0cc7f456b04cc5ee665c183b339f1cf55faf77de4ffc) but not the first one.  

---

## 1 answers

### Answer by username_1 on 2018-04-27. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_0**: Thanks for taking time looking into that, I have fixed the amount and it did work.  

---

