Bitcoin Forum
May 21, 2024, 10:10:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Import address from Sparrow to Bitcoin Core  (Read 112 times)
crypt0mancien (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 2


View Profile
March 31, 2024, 12:55:37 PM
Merited by ABCbits (1), icopress (1)
 #1

Hello,

I have many problems with Bitcoin Core.

I want to create a blank wallet in Core then import a set of address/descriptors from Sparrow.

I'm able to import descriptors with private key.

```RPC
{
  "jsonrpc": "1.0",
  "id": "curltest", 
  "method": "importdescriptors",
  "params": [
    [
      {
        "internal": true,
        "timestamp": 'now',
        "desc": "tr(tprv...rest...of...key)#checksum"
      }
    ]
  ]
}
```
Response is success: true.

For now I can track my taproot address with Core.


The problem is I can't send fund.

I try the command send, sendtoaddress, sendmany, the error is:
Transaction needs a change address, but we can't generate it. Error: No bech32 addresses available.


So I try to generate a change address like this:
```RPC
"method": "getrawchangeaddress",
  "params":
  ["bech32"]
```
Result: Error: This wallet has no available keys

So I try to import keys with importmulti, sethdseed, importprivkey.
Result: Only legacy wallets are supported by this command

Bitcoin Core version: latest 26.

Need help.
Thanks a lot
Forsyth Jones
Hero Member
*****
Offline Offline

Activity: 1176
Merit: 630


Press F for Leo


View Profile WWW
April 01, 2024, 02:58:55 AM
Last edit: April 01, 2024, 03:19:28 PM by Forsyth Jones
Merited by ABCbits (3), nc50lc (1)
 #2

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}]'

Code:
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}]'

Code:
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.

▄▄███████████████████▄▄
▄█████████▀█████████████▄
███████████▄▐▀▄██████████
███████▀▀███████▀▀███████
██████▀███▄▄████████████
█████████▐█████████▐█████
█████████▐█████████▐█████
██████████▀███▀███▄██████
████████████████▄▄███████
███████████▄▄▄███████████
█████████████████████████
▀█████▄▄████████████████▀
▀▀███████████████████▀▀
Peach
BTC bitcoin
Buy and Sell
Bitcoin P2P
.
.
▄▄███████▄▄
▄████████
██████▄
▄██
█████████████████▄
▄███████
██████████████▄
███████████████████████
█████████████████████████
████████████████████████
█████████████████████████
▀███████████████████████▀
▀█████████████████████▀
▀██████████████████▀
▀███████████████▀
▀▀███████▀▀

▀▀▀▀███▀▀▀▀
EUROPE | AFRICA
LATIN AMERICA
▄▀▀▀











▀▄▄▄


███████▄█
███████▀
██▄▄▄▄▄░▄▄▄▄▄
████████████▀
▐███████████▌
▐███████████▌
████████████▄
██████████████
███▀███▀▀███▀
.
Download on the
App Store
▀▀▀▄











▄▄▄▀
▄▀▀▀











▀▄▄▄


▄██▄
██████▄
█████████▄
████████████▄
███████████████
████████████▀
█████████▀
██████▀
▀██▀
.
GET IT ON
Google Play
▀▀▀▄











▄▄▄▀
nc50lc
Legendary
*
Offline Offline

Activity: 2422
Merit: 5614


Self-proclaimed Genius


View Profile
April 01, 2024, 06:02:29 AM
 #3

       "internal": true,
        "timestamp": 'now',
        "desc": "tr(tprv...rest...of...key)#checksum"

Response is success: true.
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:
Code:
./bitcoin-cli --named send outputs='{"<recipient address>": 0.001}' change_address=<your address>
Only with send command specifically and not the other three "send" wallet commands.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
crypt0mancien (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 2


View Profile
April 01, 2024, 02:53:21 PM
 #4

Thanks 1000 times  Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!