How to import addresses from Sparrow into Bitcoin Core

3 replies 348 views
wizard365Member
Posts: 16 · Reputation: 105
#1Nov 27, 2022, 11:41 PM
Hey everyone, I’m running into some issues with Bitcoin Core. I want to set up a new wallet in Core and then bring in a bunch of addresses/descriptors from Sparrow. I can import descriptors that come with private keys, no problem. Here’s the command I used: {   "jsonrpc": "1.0",   "id": "curltest",   "method": "importdescriptors",   "params": [     [       {         "internal": true,         "timestamp": 'now',         "desc": "tr(tprv...rest...of...key)#checksum"       }     ]   ] } Response says success: true. So now I can see my taproot address in Core. But here’s the snag I can’t send any funds. I’ve tried using send, sendtoaddress, and sendmany, but I keep getting this error: Transaction needs a change address, but we can't generate it. Error: No bech32 addresses available. Then I attempted to create a change address with this command: {"method": "getrawchangeaddress", "params": ["bech32"]} But it returned an error: This wallet has no available keys. I thought about importing keys with importmulti, sethdseed, or importprivkey but they all say: Only legacy wallets are supported by this command. Using the latest version of Bitcoin Core 26. Any suggestions? Really appreciate it.
6 Reply Quote Share
yield_forkFull Member
Posts: 162 · Reputation: 728
#2Nov 28, 2022, 04:07 AM
It seems to me that you imported the descriptor without activating the descriptor that you intend to use only for receiving, Basically you didn't include the "active":true argument in the descriptor for receiving and you also didn't include the argument: "internal":true in the descriptor you want for change addresses. I assume you already know how to import the descriptor, so I'll skip the part on how to assemble a descriptor and get the checksum. In the receive descriptor, you must include the argument: "active":true, in the change descriptor you must include both: "active":true,"internal":true. I'll leave the examples below and bold them to indicate what was missing in your descriptor. My example is in the console gui. Descriptor you would use to receive: importdescriptors '[{"desc":"tr(your_xpriv/86h/0h/0h/0/*)"#checksum","timestamp":"now","active":true}]' change descriptor: importdescriptors '[{"desc":"tr(your_xpriv/86h/0h/0h/1/*)"#checksum","timestamp":"now","active":true,"internal":true}]' As for the "importmulti, sethdseed, importprivkey" commands, they only work on legacy wallets, as the error statement says.
4 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#3Nov 28, 2022, 04:45 AM
That worked but you basically imported a single change address (internal) derived directly from the private key part of the provided "extended private key" (tprv). And it looks like that originated in your setup in Sparrow since you've mentioned that you can track it with that "weird" descriptor. Take note that the instructions above must be done in order for the the commands that require change address to work. But it will only work on "ranged descriptors" as you can see in his examples; with "derivation path", and "range" arg (defaults to 0,999 if not set). With that, you should create a proper ranged descriptor in Sparrow and import it to Bitcoin Core. If you want to keep using the setup, you can still use send command by providing the named argument: "change_address" when sending bitcoins. Example: Only with send command specifically and not the other three "send" wallet commands.
2 Reply Quote Share
wizard365Member
Posts: 16 · Reputation: 105
#4Nov 28, 2022, 09:00 AM
Thanks 1000 times
3 Reply Quote Share

Related topics