1

I am using descriptor based importmulti like so to import a 2 of 3 HD multisig cold storage wallet into my node:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importmulti", "params":[[{ "desc": "wsh(multi(2,tpubDEqRrG87fge2UkHV8PqHBtdPqtP7f5uvwj9wXf5cLkHTF17YwSS8aq4w4fjg5qFZiCvWuyJN45AZQtt9RmuQ4FUN7wN1GWKx215x1xa7Cz9/*,tpubDEv2nBbgaQ2upnS9QhBkqPvjKtLR2qyunQRNcLM3oBRLWLBqvrueByzBMR1J9mAL1z52wwQcVC5JziSskRDT8mhZWHwgRFzNoSVKgPhxTQB/*,tpubDENB49beL6joYGvVuXVqDx45f6Ev2C5xAYP7EZ2znfaJC9ZRrAWSDShy5z5KVtpZTqbrZBkwWtZ5iCzRe17EKu1W4Hq4Undk15hEXBYsgQv/*))#m6ttjdpt", "timestamp": 1567526400, "range": [0, 199], "watchonly": true, "label": "2of3" }], ''{"rescan": true}''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/wallet/2_of_3

I then fund the first address and build unsigned transaction with the new watch-only utxo:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createrawtransaction", "params":[''[{"txid":"0a172b70ce09ad04b646a37381326e7b0730791237312776d3d760baf9abbdd4","vout": 1,"sequence": 1}]'', ''{"tb1qmmjj0qqglwp23rd776plxt00ej5qjd3svs33sjp5xsj2r4d7kuaq6wgkeg":0.001, "tb1q833pzpnl3qs5ksrleu697qvyy4h8vdyat8zfsufq75fkc5dlzvnq2uagu7":0.00799748}'', 0, true] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

I then sign the transaction with the 1st private key:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransactionwithkey", "params":["0200000001d4bdabf9ba60d7d376273137127930077b6e328173a346b604ad09ce702b170a01000000000100000002a086010000000000220020dee5278008fb82a88dbef683f32defcca809363064231848343424a1d5beb73acc700b00000000002200203c6211067f88214b407fcf345f0184256e76349d59c4987120f5136c51bf132600000000", ''["cRcXi9tzP7BREA1Hnnpc27DJ5BUnpJqoLWPeHyGQqLvdhFyabu3L"]'', ''[{ "txid": "0a172b70ce09ad04b646a37381326e7b0730791237312776d3d760baf9abbdd4", "vout": 1, "scriptPubKey": "0020ad06a391657e433d8a6c06f1c663c49660275f5b1c9f3f62e36eb88e36289504", "witnessScript": "522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae", "amount": 0.00899772 }]''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

Which returns:

complete = 0;
    errors =     (
                {
            error = "Unable to sign input, invalid stack size (possibly missing key)";
            scriptSig = "";
            sequence = 1;
            txid = 0a172b70ce09ad04b646a37381326e7b0730791237312776d3d760baf9abbdd4;
            vout = 1;
            witness =             (
                "",
                "",
                522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae
            );
        }
    );
    hex = 02000000000101d4bdabf9ba60d7d376273137127930077b6e328173a346b604ad09ce702b170a01000000000100000002a086010000000000220020dee5278008fb82a88dbef683f32defcca809363064231848343424a1d5beb73acc700b00000000002200203c6211067f88214b407fcf345f0184256e76349d59c4987120f5136c51bf132603000069522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae00000000;

I then sign with the second key which is where I am getting my error:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransactionwithkey", "params":["02000000000101d4bdabf9ba60d7d376273137127930077b6e328173a346b604ad09ce702b170a01000000000100000001b0ba0d0000000000220020dee5278008fb82a88dbef683f32defcca809363064231848343424a1d5beb73a03000069522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae00000000", ''["cV6sxQh4jtkPqrGAGvAW6iZvV86zVc6QnYvFvcc72AcjQMKrF4MK"]'', ''[{ "txid": "0a172b70ce09ad04b646a37381326e7b0730791237312776d3d760baf9abbdd4", "vout": 1, "scriptPubKey": "0020ad06a391657e433d8a6c06f1c663c49660275f5b1c9f3f62e36eb88e36289504", "witnessScript": "522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae", "amount": 0.00899772 }]''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

Which returns the error:

complete = 0;
    errors =     (
                {
            error = "Signature must be zero for failed CHECK(MULTI)SIG operation";
            scriptSig = "";
            sequence = 1;
            txid = 0a172b70ce09ad04b646a37381326e7b0730791237312776d3d760baf9abbdd4;
            vout = 1;
            witness =             (
                "",
                304402205d7605839e0c2f50fce5a6eda9d614d464651d8f0c2f56659c3d897991661665022013c4c99324ee35bd72cb322cc7e165408932600a13579f8175125ec96bdb1ef701,
                "",
                522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae
            );
        }
    );
    hex = 02000000000101d4bdabf9ba60d7d376273137127930077b6e328173a346b604ad09ce702b170a01000000000100000001b0ba0d0000000000220020dee5278008fb82a88dbef683f32defcca809363064231848343424a1d5beb73a040047304402205d7605839e0c2f50fce5a6eda9d614d464651d8f0c2f56659c3d897991661665022013c4c99324ee35bd72cb322cc7e165408932600a13579f8175125ec96bdb1ef7010069522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae00000000;

What is strange is it works when I sign a third time every time, even when signing with the same private key:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransactionwithkey", "params":["02000000000101df620faaa3b1a253492fb77c6c503b9be64e5c74eba4946b99e0fa6835c83ca200000000000100000002a0860100000000001976a914344a0f48ca150ec2b903817660b9b68b13a6702688acbcba0d0000000000220020ad06a391657e433d8a6c06f1c663c49660275f5b1c9f3f62e36eb88e362895040400473044022056fd48b2c3d56044275baab3876377eb549281ddebf0ab54976f34f6eb6ae1c102204f2c0fb4a9e6cfaac95ec443d808b3d42ea4277fd20d54f23890a47618aacaf7014730440220665129661b75ddfa4375791cc47942313dc16e1f515524318f6786aa5f824e9602205af5fdef5608be722e824dec93447cd976733114a1134d1b96a5578863e3b8b70169522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae00000000", ''["cV6sxQh4jtkPqrGAGvAW6iZvV86zVc6QnYvFvcc72AcjQMKrF4MK"]'', ''[{ "txid": "a23cc83568fae0996b94a4eb745c4ee69b3b506c7cb72f4953a2b1a3aa0f62df", "vout": 0, "scriptPubKey": "0020ad06a391657e433d8a6c06f1c663c49660275f5b1c9f3f62e36eb88e36289504", "witnessScript": "522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae", "amount": 0.01 }]''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

Returns:

complete = 1;
    hex = 02000000000101df620faaa3b1a253492fb77c6c503b9be64e5c74eba4946b99e0fa6835c83ca200000000000100000002a0860100000000001976a914344a0f48ca150ec2b903817660b9b68b13a6702688acbcba0d0000000000220020ad06a391657e433d8a6c06f1c663c49660275f5b1c9f3f62e36eb88e362895040400473044022056fd48b2c3d56044275baab3876377eb549281ddebf0ab54976f34f6eb6ae1c102204f2c0fb4a9e6cfaac95ec443d808b3d42ea4277fd20d54f23890a47618aacaf7014730440220665129661b75ddfa4375791cc47942313dc16e1f515524318f6786aa5f824e9602205af5fdef5608be722e824dec93447cd976733114a1134d1b96a5578863e3b8b70169522102a3122d181aa6ea499feea9474a8da11a2e93e26138268069159fa75f90bd8e592102defeb6336a5e0c517027071fe0baee3f5fed4a3860a0000ca8b792735e1aa4172103d4d296ed881bb4c21f8ed5da6654e6109f853d21d18044e6be07d26f541a0ef153ae00000000;

Any idea what could be causing this error?

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.