How to import multi sig using importmulti correctly?

1

I create a 2 of 2 with createmultisig using 02254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f8613 and 02ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc9 pubkeys.

I then

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importmulti", "params":[[{ "scriptPubKey": { "address": "2NETfDLgh1VmER2RGRnEeWqx73Hn4xhJpU5" }, "label": "Imported MultiSig", "timestamp": "now", "keypool": false, "internal": false, "redeemscript": "522102254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f86132102ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc952ae", "pubkeys": ["02254aba14091e45a9067fbe5b225b3863d1c49650226d583dcede06a7c33f8613", "02ad64a03b7fc53c02f68eac04743b819bfeeabe6ca7007f473dbaf7c3570f5dc9"] }], ''{"rescan": false}''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18332/

Which returns a warning:

success = 1;
            warnings =             (
                "Importing as non-solvable: redeemScript does not match the scriptPubKey. If this is intentional, don't provide any keys, pubkeys, witnessscript, or redeemscript."
            );

I am using the address and redemption script createmultisig returns.

What am I doing wrong? Why is the redemption script incorrect?

My goal is to add the multi sig wallet to my node so that I can build transactions with the wallet without having to manually input the redemption script.

Fontaine

Posted 2019-07-19T03:31:41.187

Reputation: 158

Answers

1

createmultisig is likely giving you the p2sh-segwit address, not the p2sh one. This means that the "redeemScript" you get from it is actually the witnessScript and the real redeemScript is the p2wsh script for your witnessScript. You can tell createmultisig to create just a p2sh address by setting the address type parameter to legacy.

Alternatively, you can get the redeemScript for your witnessScript by usingdecodescript.decodescript` will first decode your script, then it will give you the various possible addresses for it (for each address type available) along with the scripts for them.

Andrew Chow

Posted 2019-07-19T03:31:41.187

Reputation: 40 910

1Or even better, use the descriptor based importmulti.Pieter Wuille 2019-07-19T04:22:16.920

Thanks to you both. I will try the descriptor based approach.Fontaine 2019-07-19T05:54:15.563