Bitcoin Forum
August 15, 2026, 01:01:10 AM *
News: Latest Bitcoin Core release: 31.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How To Import Private Key Into Bitcoin Core?  (Read 191 times)
Rashlyowl (OP)
Sr. Member
****
Offline

Activity: 462
Merit: 290


rākā - ₿ - vṛṣabha


View Profile WWW
May 30, 2025, 01:40:07 PM
Merited by ABCbits (2)
 #1

So I recently managed to get my own vanity address, then wanted to display it on my Bitcoin Core v28.1.0. Tried all the tutorials I could find on the internet, but they all ended up with nothing.

Tried it via console, but it just displays the following sentences:
(1) Only legacy wallets are supported by this command (code -4).
(2) No wallet is loaded. Load a wallet using loadwallet or create a new one with createwallet. (Note: A default wallet is no longer automatically created) (code -18).

Can any of you give me some proper direction for this?

BitMaxz
Legendary
*
Offline

Activity: 4074
Merit: 3666


♻️ Automatic Exchange


View Profile WWW
May 30, 2025, 02:27:21 PM
 #2

Are you trying to import a SegWit vanity address?

The most recent Bitcoin Core changed a lot; it uses a descriptor wallet, and importprivkey will not work on your current wallet.

We already have some guides available here on the forum check this one "[HOW-TO] Import privkeys into a Bitcoin Core descriptor wallet"

░░░░▄▄████████████▄
▄████████████████▀
▄████████████████▀▄█▄
▄██████▀▀░░▄███▀▄████▄
▄██████▀░░░▄███▀▀██████▄
██████▀░░▄████▄░░░▀██████
██████░░▀▀▀▀▄▄▄▄░░██████
██████▄░░░▀████▀░░▄██████
▀██████▄▄███▀░░░▄██████▀
▀████▀▄████░░▄▄███████▀
▀█▀▄████████████████▀
▄████████████████▀
▀████████████▀▀░░░░
 
 CCECASH 
DireWolfM14
Copper Member
Legendary
*
Offline

Activity: 2954
Merit: 5772



View Profile WWW
May 31, 2025, 02:31:51 AM
Last edit: May 31, 2025, 02:46:48 AM by DireWolfM14
Merited by vapourminer (8), ABCbits (7), LoyceV (6), HITTI2 (1), Rashlyowl (1)
 #3

If you type any command in the console without any additional arguments you'll get the help menu for that command.  Below are the optional arguments for the commands you'll need:

Since you want to be able to import a single private key, you'll need a "Legacy Type" wallet file, in other words a non-descriptor wallet.  To create one you'll need to add a string to your bitcoin.conf file, or start bitcoind with the option mentioned in the instructions for descriptors (option #6.)  Once you're able to create the type of wallet you want, you'll need to set the other options to be able to import a private key; i.e. you want it blank, so you can import your own private keys; obviously you'll want private keys enabled, so you can interact with the private key that you want to import; and so, based on that logic you need to apply the appropriate arguments to the createwallet command in the order they appear in the optional arguments list below:

Step 1:
Shutdown Bitcoin Core (or QT,) open your bitcoin.conf file and add the following line, then restart:
Code:
deprecatedrpc=create_bdb

Step 2:
Use the createwallet command to create a "Legacy Type" wallet
Code:
Arguments:
1. wallet_name             (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.
2. disable_private_keys    (boolean, optional, default=false) Disable the possibility of private keys (only watchonlys are possible in this mode).
3. blank                   (boolean, optional, default=false) Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed.
4. passphrase              (string, optional) Encrypt the wallet with this passphrase.
5. avoid_reuse             (boolean, optional, default=false) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
6. descriptors             (boolean, optional, default=true) Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation. Setting to "false" will create a legacy wallet; This is only possible with the -deprecatedrpc=create_bdb setting because, the legacy wallet type is being deprecated and support for creating and opening legacy wallets will be removed in the future.
7. load_on_startup         (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
8. external_signer         (boolean, optional, default=false) Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true.

Example:
Code:
createwallet "testing123" false true "testing321" true false false false

Step 3:
Select or enable the wallet you just created, then use the walletpassphrase command to unlock the wallet:
Code:
Arguments:
1. passphrase    (string, required) The wallet passphrase
2. timeout       (numeric, required) The time to keep the decryption key in seconds; capped at 100000000 (~3 years).

Example, this will unlock the wallet 10 minutes.:
Code:
walletpassphrase "testing321" 600

Step 4:
Use the importprivkey command to import your private key:
Code:
Arguments:
1. privkey    (string, required) The private key (see dumpprivkey)
2. label      (string, optional, default=current label if address exists, otherwise "") An optional label
3. rescan     (boolean, optional, default=true) Scan the chain and mempool for wallet transactions.

Example:
Code:
importprivkey "L1dybNT1HRMRcj39t3cAbEccbVvexUTFaHudGWBzUTvrR2MA2Sf2" "somethingsomethingdarkside" false

░░░░▄▄████████████▄
▄████████████████▀
▄████████████████▀▄█▄
▄██████▀▀░░▄███▀▄████▄
▄██████▀░░░▄███▀▀██████▄
██████▀░░▄████▄░░░▀██████
██████░░▀▀▀▀▄▄▄▄░░██████
██████▄░░░▀████▀░░▄██████
▀██████▄▄███▀░░░▄██████▀
▀████▀▄████░░▄▄███████▀
▀█▀▄████████████████▀
▄████████████████▀
▀████████████▀▀░░░░
 
 CCECASH 
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!