I would like to import the private keys from a multisig paper wallet to Bitcoin Core. My aim is to convert the paper wallet to an electronic wallet and to be able to export the corresponding wallet.dat. What's the recommended way of doing this via the command line?

  • What is the format of the private key ? Raw hexadecimal or WIF ? Aug 20, 2020 at 14:14
  • It's WIF uncompressed.
    – user738676
    Aug 21, 2020 at 10:12
  • Do you know the script ? Did you use a P2SH or a bare multisig ? Aug 21, 2020 at 10:45
  • I do have a P2SH redeem script.
    – user738676
    Aug 24, 2020 at 21:53

1 Answer 1


Firstly, you need to know both all the public keys, and at least the threshold (M for a M of N multisig) number of private keys.

You can then import the public keys, private keys, and script to bitcoind by using the importmulti RPC command and either providing an output descriptor or a a raw address / scriptPubkey (+ redeemScript / witnessScript if using a P2(W)SH).

To quote the help:

$ bitcoin-cli help importmulti
importmulti "requests" ( "options" )

Import addresses/scripts (with private or public keys, redeem script (P2SH)), optionally rescanning the blockchain from the earliest creation time of the imported scripts. Requires a new wallet backup.
If an address/script is imported without all of the private keys required to spend from that address, it will be watchonly. The 'watchonly' option must be set to true in this case or a warning will be returned.
Conversely, if all the private keys are provided and the address/script is spendable, the watchonly option must be set to false, or a warning will be returned.

Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls
may report that the imported keys, addresses or scripts exist but related transactions are still missing.
Note: Use "getwalletinfo" to query the scanning progress.
  • I have the required threshold number of private keys, but none of the public keys. However, as noted above, I do have a redeem script. Also, I have spent funds from the address previously. Is it possible to extract the public keys from the redeem script or a block explorer?
    – user738676
    Aug 24, 2020 at 21:58
  • Yes, if you have the redeem script or already spent funds you are fine. You can use the decodescript RPC command to get pubkeys out of the redeemscript. Aug 24, 2020 at 22:22
  • I've executed importmulti and waited for the rescan to complete, but the wallet balance is still shown as zero. Also, bitcoin-cli dumpprivkey <addr> says 'address does not refer to a key'. I provided the following parameters to importmulti: scriptPubKey (obtained via bitcoin-cli getaddressinfo <addr>), timestamp, redeemscript, pubkeys (obtained via bitcoin-cli decodescript <redeemscript>, keys. Are there any other parameters that I should have provided, or where else could this have gone wrong? Didn't get an error message or warning.
    – user738676
    Aug 25, 2020 at 11:03
  • This looks correct, if the pubkeys are in the right order. Regarding the wallet balance: it's expected that's specifically the point of the rescan. Let's wait for it to finish and see if it got some utxos Aug 25, 2020 at 11:24
  • The rescan was already finished. I left the pubkeys in the same order as returned by decodescript. Do the private keys need to be in any particular order? Note that I only have M private keys, not all N of them.
    – user738676
    Aug 25, 2020 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.