Bitcoin

Wallet – Unable to get multi-signature descriptor from Bitcoin Core.

I created a multi-signature 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'`

Afterwards, 101 blocks were created.

bitcoin-cli generatetoaddress 101 $ADDR_P2SH_P2WPKH_NATIVE_2

Then I wanted to retrieve the unused list.

bitcoin-cli listunspent 1 101 '("'$ADDR_P2SH_P2WPKH_NATIVE_2'")'

However, an empty result was returned. So I tried to get 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 caused 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 I got the same results.

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

Related Articles

Back to top button