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?
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.