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


Here the result:


Now I start with signing this raw transaction


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


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?

  • Can you include the scriptPubKey and redeemScript that you are providing?
    – Andrew Chow
    Jun 20 '18 at 8:37
  • sure, scriptPubKey a914b6ad52d2de8384b992531c0db16a7caa9637a07d87 and redeemScript 5241040d7670b3744902f837e96e5b1333494f2ff2d7828349c74e0c8fafc527dccf0659cd6caa275aaf104b83257e64ae69dbda9528760ca6cf74739f1f4c828a4c3e410414c9866a2302d74d7d940fa96bcc78792234d4bd1357e75e6107e461f7efe522c3909fb608b6c1e865eed7d5f66b1e41aa9a5245e5d073b0db3e41497bce19644104ab08b5953d7840128ba74db567cbd44470f7b6bd3f559eed9764d25f6c109a28c282f4322483165ea05a0a835afc8879f3aafea411d935e61b0e9d465f7c954053ae
    – Michael
    Jun 20 '18 at 8:41
  • 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? Jun 21 '18 at 14:53
  • 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. Jun 21 '18 at 15:06

Your Answer

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

Browse other questions tagged or ask your own question.