I am using bash, and had to remove both the spaces as well as the single quotes.
bitcoin-cli -datadir="$DATADIR" createwallet "$WALLETNAME" true true "" false true
grep "^importdescriptors" < bitcoin-core.txt | \
cut -d ' ' -f 2- | sed 's/ //g' | cut -d "'" -f 2- | cut -d "'" -f 1 | \
bitcoin-cli -datadir="$DATADIR" -rpcwallet="$WALLETNAME" -stdin importdescriptors
Where bitcoin-core.txt is a file that a coldcard might output from the “Advanced/Tools” menu under “Export Wallet”, “Bitcoin Core”.
# Bitcoin Core Wallet Import File
https://github.com/Coldcard/firmware/blob/master/docs/bitcoin-core-usage.md
## For wallet with master key fingerprint: X0000001
Wallet operates on blockchain: Bitcoin
## Bitcoin Core RPC
The following command can be entered after opening Window -> Console
in Bitcoin Core, or using bitcoin-cli:
importdescriptors '[{"active": true, "timestamp": "now", "range": [0, 100], "internal": false, "desc": "wpkh([x0000001/84h/0h/0h]xpubGoesHere/0/*)#abcdefgh"}, {"active": true, "timestamp": "now", "range": [0, 100], "internal": true, "desc": "wpkh([x0000001/84h/0h/0h]xpubGoesHere/1/*)#12345678"}]'
> **NOTE** If your UTXO was created before generating `importdescriptors` command, you should adjust the value of `timestamp` before executing command in bitcoin core.
By default it is set to `now` meaning do not rescan the blockchain. If approximate time of UTXO creation is known - adjust `timestamp` from `now` to UNIX epoch time.
0 can be specified to scan the entire blockchain. Alternatively `rescanblockchain` command can be used after executing importdescriptors command.
### Bitcoin Core before v0.21.0
This command can be used on older versions, but it is not as robust
and "importdescriptors" should be prefered if possible:
importmulti '[{"range": [0, 1000], "timestamp": "now", "keypool": true, "watchonly": true, "desc": "wpkh([x0000001/84h/0h/0h]xpubGoesHere/0/*)#abcdefgh", "internal": false}, {"range": [0, 1000], "timestamp": "now", "keypool": true, "watchonly": true, "desc": "wpkh([x0000001/84h/0h/0h]xpubGoesHere/1/*)#12345678", "internal": true}]'










