I’m stuck on this problem since yesterday and I don’t get how to fix it. How do I import a multisig address to my bitcoin-cli wallet?
I am currently doing this:
public function generateMultisigWallet($serverPubkey, $initiatorPubkey, $partnerPubkey) {
$multisig = $this->request('createmultisig', [2, [$serverPubkey, $initiatorPubkey, $partnerPubkey], 'p2sh-segwit']);
$multisig = json_decode($multisig)->result;
if(!isset($multisig->address)) {
return [false, '', ''];
}
$this->importMultisig($serverPubkey, $initiatorPubkey, $partnerPubkey);
return [true, $multisig->address, $multisig->redeemScript];
}
public function importMultisig($key1, $key2, $key3) {
$descriptor="sh(multi(2,".$key1.','.$key2.','.$key3.'))';
$descriptorInfo = $this->request('getdescriptorinfo', [$descriptor]);
$descriptorWithChecksum = json_decode($descriptorInfo)->result->descriptor;
$importData = [
[
'desc' => $descriptorWithChecksum,
'timestamp' => 'now',
"label" => "my_multisig_wallet"
]
];
$result = $this->request('importdescriptors', [$importData]);
var_dump("RESULT IS :");
var_dump($result);
return $result;
}
The problem is, I cannot get around the Error Message “Cannot import descriptor without private keys to a wallet with private keys enabled” for it, if I do not import the address I cannot get unspent UXTOs nor walletnotify works – does anybody have a solution for this? Would be extremely thankful if somebody could provide assistance.