<p>You need to use (simplified notation) <code>[{addr:amount},{addr:amount}]</code> for the outputs, not <code>[{addr:amount,addr:amount}]</code>. This is to permit multiple outputs with the same address (which wouldn't be valid JSON in your assumed syntax).</p>

<p>A simpler alternative also exists, namely <code>{addr:amount,addr:amount}</code>.</p>

CC BY-SA 4.0
2018-11-11T07:45:18.717Z
2018-11-11T07:45:18.717Z
Pieter Wuille
<p>Is this possible to do?</p>

<p>I am trying to create a transaction with 1 input that will have 3 outputs.</p>

<p>I tried: </p>

<pre><code>bitcoin-cli createrawtransaction "[{\"txid\":\"b0d6607323d5dadcd67dd1b5b6d6e5f08b70c45d187c8cf17ebfa00f9c0fb65e\",\"vout\":1}]" "[{\"2Mxmxo19LaqUePqkshcYQDzwW8SY6CpxzjN\":0.00989748, \"2N1ozs19uHsk2maPA5PiK8TEZQP8HfTd4Zn\":0.23247816, \"2NDgJmx7PykJRMK4QKTqUrfC6ewmccaq6fq\":0.0001}]"
</code></pre>

<p>But get an error:</p>

<pre><code>error code: -8
error message:
Invalid parameter, key-value pair must contain exactly one key
</code></pre>

<p>I don't understand what I'm doing wrong since the inputs and outputs both take in an array of values.</p>

<p>Any ideas? </p>

<p>This is version 0.17.0.</p>

<p>Here's the pretty print json</p>

<p>I'm pretty confident that there is no syntax issue.</p>

<pre><code>"[
    {
        \"txid\":   \"b0d6607323d5dadcd67dd1b5b6d6e5f08b70c45d187c8cf17ebfa00f9c0fb65e\",
        \"vout\":   1
    }
]" 
"[
    {
        \"2Mxmxo19LaqUePqkshcYQDzwW8SY6CpxzjN\":    0.00989748, 
        \"2N1ozs19uHsk2maPA5PiK8TEZQP8HfTd4Zn\":    0.23247816, 
        \"2NDgJmx7PykJRMK4QKTqUrfC6ewmccaq6fq\":    0.0001
    }
]"
</code></pre>

<json-rpc><bitcoin-cli><createrawtransaction>
Bitcoin-cli createrawtransaction with 3 outputs example
mocode10
# Bitcoin-cli createrawtransaction with 3 outputs example

(Asked by: username_0 on 2018-11-11)

Is this possible to do?

I am trying to create a transaction with 1 input that will have 3 outputs.

I tried:

```
bitcoin-cli createrawtransaction "[{\"txid\":\"b0d6607323d5dadcd67dd1b5b6d6e5f08b70c45d187c8cf17ebfa00f9c0fb65e\",\"vout\":1}]" "[{\"2Mxmxo19LaqUePqkshcYQDzwW8SY6CpxzjN\":0.00989748, \"2N1ozs19uHsk2maPA5PiK8TEZQP8HfTd4Zn\":0.23247816, \"2NDgJmx7PykJRMK4QKTqUrfC6ewmccaq6fq\":0.0001}]"

```

But get an error:

```
error code: -8
error message:
Invalid parameter, key-value pair must contain exactly one key

```

I don't understand what I'm doing wrong since the inputs and outputs both take in an array of values.

Any ideas?

This is version 0.17.0.

Here's the pretty print json

I'm pretty confident that there is no syntax issue.

```
"[
    {
        \"txid\":   \"b0d6607323d5dadcd67dd1b5b6d6e5f08b70c45d187c8cf17ebfa00f9c0fb65e\",
        \"vout\":   1
    }
]" 
"[
    {
        \"2Mxmxo19LaqUePqkshcYQDzwW8SY6CpxzjN\":    0.00989748, 
        \"2N1ozs19uHsk2maPA5PiK8TEZQP8HfTd4Zn\":    0.23247816, 
        \"2NDgJmx7PykJRMK4QKTqUrfC6ewmccaq6fq\":    0.0001
    }
]"

```

**Tags:** json-rpc, bitcoin-cli, createrawtransaction


---

## 1 answers

### Answer by username_1 on 2018-11-11. Score: 2 | Accepted answer

You need to use (simplified notation) `[{addr:amount},{addr:amount}]` for the outputs, not `[{addr:amount,addr:amount}]`. This is to permit multiple outputs with the same address (which wouldn't be valid JSON in your assumed syntax).

A simpler alternative also exists, namely `{addr:amount,addr:amount}`.


---

