pockets – Can’t import multisignature descriptor in Bitcoin Core


I created a multisignature deal with in regtest:

ADDR_1=`bitcoin-cli getnewaddress "" "bech32"`
ADDR_2=`bitcoin-cli getnewaddress "" "bech32"`
PB1=$(bitcoin-cli -named getaddressinfo deal with=$ADDR_1 | jq -r '.pubkey')
PB2=$(bitcoin-cli -named getaddressinfo deal with=$ADDR_2 | jq -r '.pubkey')
ADDR_P2SH_P2WPKH_NATIVE_2=`bitcoin-cli -named createmultisig nrequired=1 keys=""'["'$PB1'","'$PB2'"]''' address_type="bech32" | jq -r '.deal with'`

After that, I generated 101 blocks:

bitcoin-cli generatetoaddress 101 $ADDR_P2SH_P2WPKH_NATIVE_2

Then, I wished to retrieve the listunspent:

bitcoin-cli listunspent 1 101 '["'$ADDR_P2SH_P2WPKH_NATIVE_2'"]'

Nevertheless, it returned an empty outcome. So, I tried to import the brand new deal with utilizing 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 additionally 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 }]'

However encountered the identical outcome.

One other try 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 is nonetheless empty

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top