<p>Yes, it accepts them (and any other parameters you care to specify in the JSON).  No, it doesn't use them---and I don't know why Gavin used them in his example.</p>

<p>There's a more detailed and more up-to-date example of spending a P2SH multisig output on the <a href="https://bitcoin.org/en/developer-examples#p2sh-multisig" rel="nofollow">Bitcoin.org developer examples page</a>.</p>

CC BY-SA 3.0
2015-01-27T04:41:46.680Z
Indeed it accepts *any* number of input parameters as I found out in my tests (I even had to pass an input parameter `bananaColor=yellow` to make sure). I will check the examples you suggested, thank you!
Doug Peters
CC BY-SA 3.0
2015-01-27T04:24:15.667Z
2015-01-27T04:24:15.667Z
David A. Harding
<p>According to the built-in RPC documentation the signature for <code>createrawtransaction</code> is:
<code>createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...}</code>.</p>

<p><a href="https://gist.github.com/gavinandresen/3966071#file-twoofthree-sh-L40" rel="nofollow">Gavin in his example on 2-of-3 multisigs is also passing <code>scriptPubKey</code> and <code>redeemScript</code> as input for <code>createrawtransaction</code></a>.</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/2511a39cca78c3ca281ad6fe6d381cbb1f66c843/src/rpcrawtransaction.cpp#L304" rel="nofollow">The code of <code>createrawtransaction</code></a> in bitcoin core for <a href="https://github.com/bitcoin/bitcoin/blob/2511a39cca78c3ca281ad6fe6d381cbb1f66c843/src/rpcrawtransaction.cpp#L344" rel="nofollow">parsing inputs</a> is:</p>

<pre><code> BOOST_FOREACH(const Value&amp; input, inputs) {
   const Object&amp; o = input.get_obj();
   uint256 txid = ParseHashO(o, "txid");
   const Value&amp; vout_v = find_value(o, "vout");
   if (vout_v.type() != int_type)
   throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
   int nOutput = vout_v.get_int();
   if (nOutput &lt; 0)
   throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
   CTxIn in(COutPoint(txid, nOutput));
   rawTx.vin.push_back(in);
 }
</code></pre>

<p>so how exactly does <code>createrawtransaction</code> use <code>scriptPubKey</code> and <code>redeemScript</code>?</p>

<api><json-rpc><script><raw-transaction>
Does createrawtransction accept scriptPubKey and redeemScript as inputs?
Doug Peters
# Does createrawtransction accept scriptPubKey and redeemScript as inputs?

(Asked by: username_0 on 2015-01-27)

According to the built-in RPC documentation the signature for `createrawtransaction` is:
`createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...}`.

[Gavin in his example on 2-of-3 multisigs is also passing `scriptPubKey` and `redeemScript` as input for `createrawtransaction`](https://gist.github.com/gavinandresen/3966071#file-twoofthree-sh-L40).

[The code of `createrawtransaction`](https://github.com/bitcoin/bitcoin/blob/2511a39cca78c3ca281ad6fe6d381cbb1f66c843/src/rpcrawtransaction.cpp#L304) in bitcoin core for [parsing inputs](https://github.com/bitcoin/bitcoin/blob/2511a39cca78c3ca281ad6fe6d381cbb1f66c843/src/rpcrawtransaction.cpp#L344) is:

```
 BOOST_FOREACH(const Value& input, inputs) {
   const Object& o = input.get_obj();
   uint256 txid = ParseHashO(o, "txid");
   const Value& vout_v = find_value(o, "vout");
   if (vout_v.type() != int_type)
   throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key");
   int nOutput = vout_v.get_int();
   if (nOutput < 0)
   throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
   CTxIn in(COutPoint(txid, nOutput));
   rawTx.vin.push_back(in);
 }

```

so how exactly does `createrawtransaction` use `scriptPubKey` and `redeemScript`?

**Tags:** api, json-rpc, script, raw-transaction


---

## 1 answers

### Answer by username_1 on 2015-01-27. Score: 3 | Accepted answer

Yes, it accepts them (and any other parameters you care to specify in the JSON). No, it doesn't use them---and I don't know why Gavin used them in his example.

There's a more detailed and more up-to-date example of spending a P2SH multisig output on the [Bitcoin.org developer examples page](https://bitcoin.org/en/developer-examples#p2sh-multisig).

> **Comments:**
> **username_0**: Indeed it accepts *any* number of input parameters as I found out in my tests (I even had to pass an input parameter `bananaColor=yellow` to make sure). I will check the examples you suggested, thank you!  

---

