I have been trying to test importmulti with BIP84 derivation like so:
bitcoin-cli -rpcwallet=BIP84Test importmulti '[{ "desc": "wpkh([18734cbe/84'/0'/0']xpub6AC5B4KkrtMkXmzUWAiVVYWvhzwMJDX46ZJhm2tusm7SPc2KjeSqwEjLTaB8vAo7ev3zUFbGdWcX3EMy1ZQ9JxDgpc1pzBGLVpftq84naq5/0/*)#shfp59jm", "timestamp": "now", "range": [0, 99], "watchonly": true, "label": "Fully Noded Cold Storage", "keypool": true, "internal": false, "rescan": false }]'
But I always get an error:
-bash: syntax error near unexpected token `)'
I have tried replacing [18734cbe/84'/0'/0']
with [18734cbe/84h/0h/0h]
and [18734cbe/84\'/0\'/0\']
But it all returns errors. Is there anything obvious I am doing wrong?
I get the descriptor from getdescriptorinfo
EDIT:
Here is the fix which is working:
First get the descriptor using getdescriptorinfo
then:
var descriptor = "\"\(result["descriptor"] as! String)\""
descriptor = descriptor.replacingOccurrences(of: "4'", with: "4'\"'\"'")
descriptor = descriptor.replacingOccurrences(of: "0'", with: "0'\"'\"'")
bitcoin-cli -rpcwallet=NewTest importmulti '[{ "desc": "wpkh([18734cbe/84'"'"'/0'"'"'/0'"'"']xpub6AC5B4KkrtMkXmzUWAiVVYWvhzwMJDX46ZJhm2tusm7SPc2KjeSqwEjLTaB8vAo7ev3zUFbGdWcX3EMy1ZQ9JxDgpc1pzBGLVpftq84naq5/0/*)#jun2ynxt", "timestamp": "now", "range": [0, 99], "watchonly": true, "label": "Fully Noded Cold Storage", "keypool": true, "internal": false }]' '{"rescan": false}'
result = (
{
success = 1;
}
)
Very hacky but it works :)