<p>I have 3 private keys (a,b,c) which belong to an address (2 of 3) from which I want to spend funds using RPC commands.</p>

<p>I´ve started with generating the redeemScript using <code>createmultisig()</code> and the pub keys which I have generated from the 3 priv Keys (using bitwasp). As the result returns the correct address this step seems to be correct.</p>

<p>After importing the address to my node and rescanning the blockchain I execute <code>listunspend()</code> to get the unspend outputs for my rawtransaction.</p>

<p>Now I generate the raw tx using </p>

<pre><code>createrawtransaction({txid,vout,scriptPubKey,redeemScript},{address:amount})
</code></pre>

<p>Here the result:</p>

<pre><code>020000000195b96fa7fff141564feba34cb669bdeb94953c98ae864465623def3fbe9e9fb10100000000ffffffff01e87a01000000000017a9145766fcbfc6927c0b027e4b4245fffcb1ec16f64b8700000000
</code></pre>

<p>Now I start with signing this raw transaction</p>

<pre><code>signrawtransaction(rawtx,{txid,vout,scriptPubKey,redeemScript},privKey1)
</code></pre>

<p>The result of this signing process is used for the second step</p>

<pre><code>signrawtransaction(signedrawtx,{txid,vout,scriptPubKey,redeemScript},privKey2)
</code></pre>

<p>The first signing step returns <code>"Operation not valid with the current stack size"</code> which, as far as I know is correct if a multisig address is involved and not enough keys have signed the tx.</p>

<p>The second step returns <code>"Signature must be zero for failed CHECK(MULTI)SIG operation"</code> which I don´t understand. What's going wrong here?
Even if I change the used priv keys and use the second or third key for the first signing step and one other for the second the error still persits. Am I missing a thing?</p>

CC BY-SA 4.0
2018-06-20T08:37:39.980Z
Can you include the `scriptPubKey` and `redeemScript` that you are providing?
Ava Chow
CC BY-SA 4.0
2018-06-20T08:41:17.083Z
sure, scriptPubKey `a914b6ad52d2de8384b992531c0db16a7caa9637a07d87` and redeemScript `5241040d7670b3744902f837e96e5b1333494f2ff2d7828349c74e0c8fafc527dccf0659cd6caa275aaf104b83257e64ae69dbda9528760ca6cf74739f1f4c828a4c3e410414c9866a2302d74d7d940fa96bcc78792234d4bd1357e75e6107e461f7efe522c3909fb608b6c1e865eed7d5f66b1e41aa9a5245e5d073b0db3e41497bce19644104ab08b5953d7840128ba74db567cbd44470f7b6bd3f559eed9764d25f6c109a28c282f4322483165ea05a0a835afc8879f3aafea411d935e61b0e9d465f7c954053ae`
Michael
CC BY-SA 4.0
2018-06-21T14:53:58.350Z
I guess you are on bitcoin client v0.16 (version is 0200000)? createrawtransaction doesn't require scriptPubKey, see (my) post last recently here: bitcoin.stackexchange.com/questions/75931 ...and looking at the createrawtransaction line, it shows usage of previous transaction: B19F9EBE3FEF3D62654486AE983C9594EBBD69B64CA3EB4F5641F1FFA76FB995 - when I look into block explorer, I don't find it (on testnet3)... and the address behind scriptPubkey (32KNsVp616bdKoobZ3L3y4HTyWCypeCD8VrQiGt) has zero funds. Was it funded to spend from? What is the funding tx ID?
pebwindkraft
CC BY-SA 4.0
2018-06-21T15:06:11.580Z
you can go "sendtoaddress 32KNsVp616bdKoobZ3L3y4HTyWCypeCD8VrQiGt", then "generate 1" to create a block, then listunspent, to verify. Check the address field, use the displayed tx ID, and create the transaction with the "createrawtransaction" command? You can show each command and result, that helps us to support.
pebwindkraft
<raw-transaction><createrawtransaction><signrawtransaction>
Multisig signrawtransaction fails
Michael
# Multisig signrawtransaction fails

(Asked by: username_0 on 2018-06-20)

I have 3 private keys (a,b,c) which belong to an address (2 of 3) from which I want to spend funds using RPC commands.

I´ve started with generating the redeemScript using `createmultisig()` and the pub keys which I have generated from the 3 priv Keys (using bitwasp). As the result returns the correct address this step seems to be correct.

After importing the address to my node and rescanning the blockchain I execute `listunspend()` to get the unspend outputs for my rawtransaction.

Now I generate the raw tx using

```
createrawtransaction({txid,vout,scriptPubKey,redeemScript},{address:amount})

```

Here the result:

```
020000000195b96fa7fff141564feba34cb669bdeb94953c98ae864465623def3fbe9e9fb10100000000ffffffff01e87a01000000000017a9145766fcbfc6927c0b027e4b4245fffcb1ec16f64b8700000000

```

Now I start with signing this raw transaction

```
signrawtransaction(rawtx,{txid,vout,scriptPubKey,redeemScript},privKey1)

```

The result of this signing process is used for the second step

```
signrawtransaction(signedrawtx,{txid,vout,scriptPubKey,redeemScript},privKey2)

```

The first signing step returns `"Operation not valid with the current stack size"` which, as far as I know is correct if a multisig address is involved and not enough keys have signed the tx.

The second step returns `"Signature must be zero for failed CHECK(MULTI)SIG operation"` which I don´t understand. What's going wrong here?
Even if I change the used priv keys and use the second or third key for the first signing step and one other for the second the error still persits. Am I missing a thing?

**Tags:** raw-transaction, createrawtransaction, signrawtransaction

> **Comments:**
> **username_1**: Can you include the `scriptPubKey` and `redeemScript` that you are providing?  
> **username_0**: sure, scriptPubKey `a914b6ad52d2de8384b992531c0db16a7caa9637a07d87` and redeemScript `5241040d7670b3744902f837e96e5b1333494f2ff2d7828349c74e0c8fafc527dccf0659cd6caa275aaf104b83257e64ae69dbda9528760ca6cf74739f1f4c828a4c3e410414c9866a2302d74d7d940fa96bcc78792234d4bd1357e75e6107e461f7efe522c3909fb608b6c1e865eed7d5f66b1e41aa9a5245e5d073b0db3e41497bce19644104ab08b5953d7840128ba74db567cbd44470f7b6bd3f559eed9764d25f6c109a28c282f4322483165ea05a0a835afc8879f3aafea411d935e61b0e9d465f7c954053ae`  
> **username_2**: I guess you are on bitcoin client v0.16 (version is 0200000)? createrawtransaction doesn't require scriptPubKey, see (my) post last recently here: bitcoin.stackexchange.com/questions/75931 ...and looking at the createrawtransaction line, it shows usage of previous transaction: B19F9EBE3FEF3D62654486AE983C9594EBBD69B64CA3EB4F5641F1FFA76FB995 - when I look into block explorer, I don't find it (on testnet3)... and the address behind scriptPubkey (32KNsVp616bdKoobZ3L3y4HTyWCypeCD8VrQiGt) has zero funds. Was it funded to spend from? What is the funding tx ID?  
> **username_2**: you can go "sendtoaddress 32KNsVp616bdKoobZ3L3y4HTyWCypeCD8VrQiGt", then "generate 1" to create a block, then listunspent, to verify. Check the address field, use the displayed tx ID, and create the transaction with the "createrawtransaction" command? You can show each command and result, that helps us to support.  

---

## 0 answers

