I have issues trying to sign a 2/3 multisig tx with the first private key.

What am I doing something wrong or am I missing something for the arg?

Command format:

/usr/bin/bitcoin-cli -testnet signrawtransactionwithkey "multisig_tx_hexstring" \"privatekey1\"  {\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"}

Filled in:

/usr/bin/bitcoin-cli -testnet signrawtransactionwithkey "02000000017b0cd6ab6beebace32e00f27aea8092879e178a77d2d0e74d001e10b39f560d10100000000ffffffff0100093d000000000017a9145e235c002eb66a1c33abccfb805043a036baf7798700000000" \"cNoe7mVGEVFwUwQXuCJadosEVPYU5rcCVxzTr46gYWbWMD8gXR7b\"  {\"txid\":\"d160f5390be101d0740e2d7da778e1792809a8ae270fe032cebaee6babd60c7b\",\"vout\":1,\"scriptPubKey\":\"a9145c975f4c6d18fa1abd25018e1fa3c18e58c9e93b87\",\"redeemScript\":\"5221029558bd8bc6e0cac883cac93a420bf8e68e76e8e07944f6034e3c5eadd3f1a4db21038d217a8fa3960a3b3212bc545566c5c48add11003551cb23c0d744a13f9ab8272102fcd0e6ff324c7a3bc9a8e224d61cd9ccd244c54186848ca3035a54736a9780d653ae\"}

And the error:

error: Error parsing JSON:"txid":"d160f5390be101d0740e2d7da778e1792809a8ae270fe032cebaee6babd60c7b"
  • you need to pack the JSON object in quotes ` Dec 6, 2018 at 2:07

1 Answer 1


Try this:

You need to provide the private keys and the utxo as arrays and make sure it is valid json and in quotes.

$ /usr/bin/bitcoin-cli -testnet signrawtransactionwithkey "02000000017b0cd6ab6beebace32e00f27aea8092879e178a77d2d0e74d001e10b39f560d10100000000ffffffff0100093d000000000017a9145e235c002eb66a1c33abccfb805043a036baf7798700000000" '["cNoe7mVGEVFwUwQXuCJadosEVPYU5rcCVxzTr46gYWbWMD8gXR7b"]' '[{"txid":"d160f5390be101d0740e2d7da778e1792809a8ae270fe032cebaee6babd60c7b","vout":1,"scriptPubKey":"a9145c975f4c6d18fa1abd25018e1fa3c18e58c9e93b87","redeemScript":"5221029558bd8bc6e0cac883cac93a420bf8e68e76e8e07944f6034e3c5eadd3f1a4db21038d217a8fa3960a3b3212bc545566c5c48add11003551cb23c0d744a13f9ab8272102fcd0e6ff324c7a3bc9a8e224d61cd9ccd244c54186848ca3035a54736a9780d653ae"}]'

  • Ok, so the single and double quotes instead of backslashes, got it.
    – Tom
    Dec 6, 2018 at 2:17
  • Also, if I want to sign one key at a time, do I need to set the sighashtype param to 'SINGLE' ?
    – Tom
    Dec 6, 2018 at 2:18
  • No, sighash is a way to specify what you actually want to sign, not the keys you want to sign with. See bitcoin.org/en/developer-guide#term-signature-hash
    – JBaczuk
    Dec 6, 2018 at 2:24
  • no problem. You could also provide the quoted json in this format (escaping the inner quotes): "[\"privkey\"]" but I find the above easier to read.
    – JBaczuk
    Dec 6, 2018 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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