I've been running into a lot of trouble getting a transaction to spend coins in a multisig address.

I create the raw transaction When I go to sign, I get "Operation not valid with the correct stack size"

I'm using core, and the codes are here.

First, check if it's good.

bitcoin-cli decoderawtransaction 0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd0000000000ffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000
    "txid" : "e71006c60dbfa2793710d5cf866d1b6b89ba80bc41634031d927738c40ae8228",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
            "txid" : "dd21e637fb06de23fa60e5df1841d9c584e4372611023822f5e86b5456a4abd2",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            "sequence" : 4294967295
    "vout" : [
            "value" : 0.00490000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 a4f29e1c8f592021fd79eda1be85c96a9a8d349a OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [

And then we go to sign.

bitcoin-cli signrawtransaction 0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd0000000000ffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000
    "hex" : "0100000001d2aba456546be8f5223802112637e484c5d94118dfe560fa23de06fb37e621dd000000009200483045022100eaae5737ab000f614ce73da11ba456b4467cf640ed881fd1fa90183d1d28c2e8022066c78bf750ae0a175f6ef116ecc3e4a0c18eda1aff9c951952f8f6e45a3521ad0147522102908921b30aa37fe6e522c528cca0ebcda9f0df4019301fa45bc3b3c7df60245a2103559dc92d6e44a98080d487e585b93278106249a166795584ae554a4275f059b752aeffffffff01107a0700000000001976a914a4f29e1c8f592021fd79eda1be85c96a9a8d349a88ac00000000",
    "complete" : false,
    "errors" : [
            "txid" : "dd21e637fb06de23fa60e5df1841d9c584e4372611023822f5e86b5456a4abd2",
            "vout" : 0,
            "scriptSig" : "00483045022100eaae5737ab000f614ce73da11ba456b4467cf640ed881fd1fa90183d1d28c2e8022066c78bf750ae0a175f6ef116ecc3e4a0c18eda1aff9c951952f8f6e45a3521ad0147522102908921b30aa37fe6e522c528cca0ebcda9f0df4019301fa45bc3b3c7df60245a2103559dc92d6e44a98080d487e585b93278106249a166795584ae554a4275f059b752ae",
            "sequence" : 4294967295,
            "error" : "Operation not valid with the current stack size"

I'm using https://gist.githubusercontent.com/gavinandresen/3966071/raw/ca21870c190ba0e90c1a30673e790ef5acd207d2/TwoOfThree.sh for reference.

  • Do you have all of the keys necessary to spend this output? This looks like it signed with some of the keys, but you need another. – Nick ODell Aug 31 '15 at 2:41
  • Is that what it means? I didnt even think that it signed part, it seems to give no sign of partial success. yes, i only have one of the required keys, but what part of that shows it partly signed? – Drazisil Aug 31 '15 at 2:49
  • Well, it's longer. – Nick ODell Aug 31 '15 at 2:50
  • 1
    Thank you so much! Please, write up an answer and I will accept. What genius decided to code such a user-unfriendlt 'success' – Drazisil Aug 31 '15 at 3:04

You get this error because Bitcoin has tried to validate the script, and failed, because not all of the signatures necessary were added in the previous signrawtransaction. You can also tell this because complete is false.

You need to take it to clients that have the other keys necessary, and run signrawtransaction on the transaction there too.

|improve this answer|||||
  • 3
    To further clarify, for future viewers, you can tell that the tx is partly signed by running the returned hash though decoderawtransaction and noting that you now have content in the vin scriptsig field. It really should have a message saying it was partly signed, but it doesn't. – Drazisil Aug 31 '15 at 3:49
  • @Drazisil Why do I get content in the scriptsig of vin? – Shabahat M. Ayubi Mar 31 '17 at 15:40

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.