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.

The code of createrawtransaction in bitcoin core for parsing inputs 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));

so how exactly does createrawtransaction use scriptPubKey and redeemScript?


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.

  • 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! Jan 27 '15 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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