Bitcoin Forum
May 03, 2024, 02:19:23 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin core import p2wpkh  (Read 187 times)
Sunset78 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 15


View Profile
August 15, 2022, 09:06:06 AM
Merited by OmegaStarScream (4), LoyceV (4), o_e_l_e_o (4), ABCbits (3)
 #1

Hi!
I ask for help with the import p2wpkh address from Electrum to Bitcoin core.


I use the command importprivkey ********* , but I get an error in response This type of wallet does not support this command (code -4)

I tried various options, but unfortunately it didn't work out to import. After spending a lot of time in Google, I realized that it was about some descriptors, but I do not know how to use and add them. And maybe it's not about them at all. Please help me.



Ubuntu 22.04.1 LTS
Linux 5.15.0-46-generic #49-Ubuntu
Client version: v23.0.0
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714702763
Hero Member
*
Offline Offline

Posts: 1714702763

View Profile Personal Message (Offline)

Ignore
1714702763
Reply with quote  #2

1714702763
Report to moderator
1714702763
Hero Member
*
Offline Offline

Posts: 1714702763

View Profile Personal Message (Offline)

Ignore
1714702763
Reply with quote  #2

1714702763
Report to moderator
1714702763
Hero Member
*
Offline Offline

Posts: 1714702763

View Profile Personal Message (Offline)

Ignore
1714702763
Reply with quote  #2

1714702763
Report to moderator
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16585


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
August 15, 2022, 09:17:37 AM
Merited by hosseinimr93 (1)
 #2

After spending a lot of time in Google, I realized that it was about some descriptors
I haven't used descriptor wallets yet, but achow101 on Stack Exchange gives this solution:
Quote
The migration tool has not been implemented yet, and it is not for manually importing keys. Rather it takes an existing wallet and migrates everything in that wallet.

As the error message says, descriptor wallets do not support the importprivkey. You will have to use importdescriptors with the private key you want to import as part of the proper descriptor.

For example, if you wanted to import the p2wpkh address for a private key, you would make a descriptor of the form wpkh(<privkey>). Then use getdescriptorinfo to get the checksum and create wpkh(<privkey>)#<checksum>, and then use importdescriptors to import that descriptor
Or maybe you can still create a New Wallet and untick Descriptor Wallet.

Sunset78 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 15


View Profile
August 15, 2022, 09:25:56 AM
 #3

After spending a lot of time in Google, I realized that it was about some descriptors
I haven't used descriptor wallets yet, but achow101 on Stack Exchange gives this solution:
Quote
The migration tool has not been implemented yet, and it is not for manually importing keys. Rather it takes an existing wallet and migrates everything in that wallet.

As the error message says, descriptor wallets do not support the importprivkey. You will have to use importdescriptors with the private key you want to import as part of the proper descriptor.

For example, if you wanted to import the p2wpkh address for a private key, you would make a descriptor of the form wpkh(<privkey>). Then use getdescriptorinfo to get the checksum and create wpkh(<privkey>)#<checksum>, and then use importdescriptors to import that descriptor
Or maybe you can still create a New Wallet and untick Descriptor Wallet.

Unfortunately wpkh returns the error Method not found (code -32601)

I have a seed phrase, can I somehow import it from electrum? Or convert to a suitable bitcoin core format
Sunset78 (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 15


View Profile
August 15, 2022, 09:37:26 AM
 #4

Or maybe you can still create a New Wallet and untick Descriptor Wallet.
Solution:
Creating new wallet without descriptions. It works!
I am very grateful!

Do I need to do rescan?
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16585


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
August 15, 2022, 09:55:01 AM
 #5

I have a seed phrase, can I somehow import it from electrum?
I don't think that's possible. You'll have to import all addresses separately.

Do I need to do rescan?
If the address has a balance: yes.

nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5581


Self-proclaimed Genius


View Profile
August 15, 2022, 10:22:40 AM
 #6

Solution:
Creating new wallet without descriptions. It works!
I am very grateful!

Do I need to do rescan?
If you haven't added "false" flag after importprivkey, it should automatically do a rescan. If it didn't rescan, you need to since it's necessary to update the balance.
Also, you can also use a blank wallet (non-descriptor) wallet if you do not want to have other private keys in your wallet.

For descriptor wallet, you can try this (to import your whole Electrum wallet): https://bitcointalk.org/index.php?topic=5399337.msg60178631#msg60178631
But instead of "xpub" key, import the "xpriv" key that you can get using the command in Electrum's console: getmasterprivate()
Also, you must add \"active\": true, to the 'receiving' and 'change' descriptors to set those as the active descriptors.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
mertliti
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile
October 23, 2022, 06:43:08 PM
 #7

For descriptor wallet, you can try this (to import your whole Electrum wallet): https://bitcointalk.org/index.php?topic=5399337.msg60178631#msg60178631
But instead of "xpub" key, import the "xpriv" key that you can get using the command in Electrum's console: getmasterprivate()
Also, you must add \"active\": true, to the 'receiving' and 'change' descriptors to set those as the active descriptors.

Very helpful! Thank you.

I removed the \"watching-only\": false, from the descriptors also.

Would this work also on a non blank wallet? Or will it cause problems to have multiple active descriptors?
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5581


Self-proclaimed Genius


View Profile
October 24, 2022, 05:13:00 AM
 #8

Would this work also on a non blank wallet? Or will it cause problems to have multiple active descriptors?
Since it's not a blank wallet, it will be pre-loaded with active descriptors for Legacy, P2SH-SegWit, Bech32 (SegWit) and Bech32m (Taproot), plus another set for change.
If you set a new descriptor as active (the tutorial doesn't include active flags), it will deactivate the previous active descriptor of the same type,
but your wallet can have multiple active descriptors as long as those are for different script types and for change (internal) or not.

Importing more descriptors will work but only the active descriptors will be used when prompting for a new address/change.
The non-active ones will still be scanned for transaction/balance.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
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!