<p><a href="https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification</a>
The above link helped me in achieving the scenario.</p>
<p>Original raw_tx:
020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302000000001976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000</p>
<p>020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41
ffffffff
02
1027000000000000 - 10 27 00 00 00 00 00 00 - 00002710 - hex o decimal - 10000 * 0.00000001 = 0.0001
19
76a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac
70e4530200000000 - 70 e4 53 02 00 00 00 00 - 0253e470 - hex to decimal - 39052400 * 0.00000001 = 0.390524
19
76a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac
00000000</p>
<p>Final raw_tx required for this error scenario:
020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302ffffffff1976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000</p>
<p>As you can see above that I just replaced eight zeroes to eight f's.</p>

CC BY-SA 4.0
2020-08-27T18:59:53.670Z
2020-08-27T18:59:53.670Z
Bhala T R
<p>The <code>createrawtransaction</code> command will do a sanity check of the arguments and return the <code>Amount out of range</code> error <a href="https://github.com/bitcoin/bitcoin/blob/a2a250c7d07bcb80cefca9dd4a7ce57f41291334/src/amount.h#L26" rel="nofollow noreferrer">if the value is not <code>&gt;= 0</code> and <code>&lt;= 21000000 * 10e7</code></a>, so that you don't shoot yourself in the foot.</p>
<p>You need to craft the invalid on your own, you can see <a href="https://github.com/bitcoin/bitcoin/blob/a2a250c7d07bcb80cefca9dd4a7ce57f41291334/test/functional/data/invalid_txs.py#L176" rel="nofollow noreferrer">an example of precisely what you are trying to achieve in the functional test suite</a> (which uses python-bitcoinlib).</p>

CC BY-SA 4.0
2020-08-18T14:50:05.380Z
2020-08-18T14:50:05.380Z
Antoine Poinsot
<p>I wanted to replicate the <code>bad-txns-vout-negative error</code> scenario. I tried the following but getting 'Amount out of range' only:</p>
<p>Here is the command i tried:</p>
<pre><code>bitcoin-cli -named createrawtransaction inputs=&quot;[{\&quot;txid\&quot;:\&quot;af7cc9204d0ab7d52f66a5dacb79b77c34c90013e3288a391557ee8e07c3c307\&quot;,\&quot;vout\&quot;:&quot;0&quot;}]&quot; outputs=&quot;{\&quot;data\&quot;: \&quot;6e636861696e20626974636f696e207361746f73686920766973696f6e\&quot;,\&quot;myTmAe67rCuJU5X1fqKiEYohb53TEQrxP3\&quot;: 6.249996,\&quot;mt8QSx6m6Fwqt8zMVcji16UiVYS8xYRwFi\&quot;: -0.001000}&quot;
error code: -3
error message:
Amount out of range
</code></pre>

<bitcoin-core><transactions><bitcoind><bitcoin-cli><error>
How to raise the bad-txns-vout-negative error?
Bhala T R
# How to raise the bad-txns-vout-negative error?

(Asked by: username_0 on 2020-08-18)

I wanted to replicate the `bad-txns-vout-negative error` scenario. I tried the following but getting 'Amount out of range' only:

Here is the command i tried:

```
bitcoin-cli -named createrawtransaction inputs="[{\"txid\":\"af7cc9204d0ab7d52f66a5dacb79b77c34c90013e3288a391557ee8e07c3c307\",\"vout\":"0"}]" outputs="{\"data\": \"6e636861696e20626974636f696e207361746f73686920766973696f6e\",\"myTmAe67rCuJU5X1fqKiEYohb53TEQrxP3\": 6.249996,\"mt8QSx6m6Fwqt8zMVcji16UiVYS8xYRwFi\": -0.001000}"
error code: -3
error message:
Amount out of range

```

**Tags:** bitcoin-core, transactions, bitcoind, bitcoin-cli, error


---

## 2 answers

### Answer by username_0 on 2020-08-27. Score: 0 | Accepted answer

<https://en.bitcoin.it/wiki/Protocol_documentation#Transaction_Verification>
The above link helped me in achieving the scenario.

Original raw\_tx:
020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302000000001976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000

020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41
ffffffff
02
1027000000000000 - 10 27 00 00 00 00 00 00 - 00002710 - hex o decimal - 10000 \* 0.00000001 = 0.0001
19
76a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac
70e4530200000000 - 70 e4 53 02 00 00 00 00 - 0253e470 - hex to decimal - 39052400 \* 0.00000001 = 0.390524
19
76a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac
00000000

Final raw\_tx required for this error scenario:
020000000107f0dd405759fa448d500ea323e4e4a088bcdbf160e87c262e0467df61156166000000004847304402205e5a5d6dff4c7dcce55e5b1271e9d4da3cfefe1661103dba9806966954ac27420220366556056450adbee603ed76a157d518d38767edc1f6a6c86f51be7d8c29f90f41ffffffff0210270000000000001976a9148d0391dafaa4157b0349f1f5b44855a36e46a7b388ac70e45302ffffffff1976a914e4eddb8f459be89a0ac48bd76f11f0198b20a98188ac00000000

As you can see above that I just replaced eight zeroes to eight f's.


---

### Answer by username_1 on 2020-08-18. Score: 1

The `createrawtransaction` command will do a sanity check of the arguments and return the `Amount out of range` error [if the value is not `>= 0` and `<= 21000000 * 10e7`](https://github.com/bitcoin/bitcoin/blob/a2a250c7d07bcb80cefca9dd4a7ce57f41291334/src/amount.h#L26), so that you don't shoot yourself in the foot.

You need to craft the invalid on your own, you can see [an example of precisely what you are trying to achieve in the functional test suite](https://github.com/bitcoin/bitcoin/blob/a2a250c7d07bcb80cefca9dd4a7ce57f41291334/test/functional/data/invalid_txs.py#L176) (which uses python-bitcoinlib).


---

