I created a multisignature address in regtest:
ADDR_1=`bitcoin-cli getnewaddress "" "bech32"`
ADDR_2=`bitcoin-cli getnewaddress "" "bech32"`
PB1=$(bitcoin-cli -named getaddressinfo address=$ADDR_1 | jq -r '.pubkey')
PB2=$(bitcoin-cli -named getaddressinfo address=$ADDR_2 | jq -r '.pubkey')
ADDR_P2SH_P2WPKH_NATIVE_2=`bitcoin-cli -named createmultisig nrequired=1 keys=""'["'$PB1'","'$PB2'"]''' address_type="bech32" | jq -r '.address'`
After that, I generated 101 blocks:
bitcoin-cli generatetoaddress 101 $ADDR_P2SH_P2WPKH_NATIVE_2
Then, I wanted to retrieve the listunspent:
bitcoin-cli listunspent 1 101 '["'$ADDR_P2SH_P2WPKH_NATIVE_2'"]'
However, it returned an empty result. So, I attempted to import the new address using addr():
CHECKSUM=$(bitcoin-cli getdescriptorinfo "addr($ADDR_P2SH_P2WPKH_NATIVE_2)" | jq -r .checksum)
bitcoin-cli importdescriptors '[{ "desc": "addr('$ADDR_P2SH_P2WPKH_NATIVE_2')#'"$CHECKSUM"'", "timestamp": "now", "internal": true }]'
This resulted in an error:
[
{
"success": false,
"error": {
"code": -4,
"message": "Cannot import descriptor without private keys to a wallet with private keys enabled"
}
}
]
I also tried:
CHECKSUM=$(bitcoin-cli getdescriptorinfo "wsh(multi(1,$PB1,$PB2))" | jq -r .checksum)
bitcoin-cli importdescriptors '[{ "desc": "wsh(multi(1,'$PB1','$PB2'))#'"$CHECKSUM"'", "timestamp": "now", "internal": true }]'
But encountered the same result.
Another attempt is
bitcoin-cli -named createwallet wallet_name="bia" disable_private_keys=true
CHECKSUM=$(bitcoin-cli getdescriptorinfo "wsh(multi(1,$PB1,$PB2))" | jq -r .checksum)
bitcoin-cli -rpcwallet=bia importdescriptors '[{ "desc": "wsh(multi(1,'$PB1','$PB2'))#'"$CHECKSUM"'", "timestamp": "now", "internal": true }]'
bitcoin-cli -rpcwallet=bia listunspent 1 6 '["'$ADDR_P2SH_P2WPKH_NATIVE_2'"]'
it’s still empty