Alternatively, you can use
importdescriptors to a descriptor wallet.
If the address is from Bitcoin Core, use
getaddressinfo to get the address' descriptor and import it to your watching only wallet.
If from other wallets, construct a descriptor based from the address' pubKey and script type.
e.g. (
RegTest):
getaddressinfo bcrt1q45ylq9spcg0q5aqzjcfu9ndxqawj28trxylq85
"desc": "wpkh([057761c1/0'/0'/1019']02b11c7ade3d64dc2a7fbaf43af8a021cc23a834895d3c16fbb276961f40380467)#sdng4gmc",
Import to MyWatchWallet (
prvKey disabled):
importdescriptors "[{ \"desc\": \"wpkh([057761c1/0'/0'/1019']02b11c7ade3d64dc2a7fbaf43af8a021cc23a834895d3c16fbb276961f40380467)#sdng4gmc\", \"timestamp\":0,\"label\": \"incoming-from-xxxxxxxx\"}]"
I tried
getaddressinfo in my online node. But the address in question is not from this node and I got no field named "desc": like in your case!
I tried with 2 wallets I have in this online node.
$ bitcoin-cli --rpcwallet=MyWatchWallet getwalletinfo
{
"walletname": "MyWatchWallet",
"walletversion": 169900,
"format": "sqlite",
"balance": 0.00000000,
"unconfirmed_balance": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 0,
"keypoolsize": 0,
"keypoolsize_hd_internal": 0,
"paytxfee": 0.00000000,
"private_keys_enabled": false,
"avoid_reuse": false,
"scanning": false,
"descriptors": true,
"external_signer": false
}
and:
$ bitcoin-cli --rpcwallet=p2tr-wallet getwalletinfo
{
"walletname": "p2tr-wallet",
"walletversion": 169900,
"format": "sqlite",
"balance": 0.00000000,
"unconfirmed_balance": 0.00000000,
"immature_balance": 0.00000000,
"txcount": 0,
"keypoolsize": 4000,
"keypoolsize_hd_internal": 4000,
"unlocked_until": 0,
"paytxfee": 0.00000000,
"private_keys_enabled": true,
"avoid_reuse": false,
"scanning": false,
"descriptors": true,
"external_signer": false
}
Both are descriptor wallets but no field named "desc"
$ bitcoin-cli --rpcwallet=MyWatchWallet getaddressinfo bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{
"address": "bc1qxxxxxxxxxxxxxxxxxxxxxxxx",
"scriptPubKey": "0014xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ismine": false,
"solvable": false,
"iswatchonly": false,
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "bbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ischange": false,
"labels": [
]
}
and
$ bitcoin-cli --rpcwallet=p2tr-wallet getaddressinfo bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{
"address": "bc1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"scriptPubKey": "001xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ismine": false,
"solvable": false,
"iswatchonly": false,
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "bbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ischange": false,
"labels": [
]
}
So, I presume I need to do this in the same node as the one where the addresses were created?