Bitcoin Core is the primary software for interacting with the blockchain of the first cryptocurrency. It can be used as a server (a node) or as a wallet. In Satoshi's time, Bitcoin Core was the only option for storing BTC, but over time, many other options for storing bitcoin have emerged. However, if you are still using Bitcoin Core the old-fashioned way, you need to know that since version 21.0, so-called descriptor wallets have been introduced, which will soon completely replace the familiar wallet.dat

Wallet.dat is still supported in the latest version, Bitcoin Core 29.0, but it warns that this format for storing private keys is now outdated, and sooner or later, everyone will have to switch to the new format. Although initially in 2021, when version 21.0 was released, the Bitcoin Core developers planned to fully transition to descriptor wallets by 2023.

 

So, what is so bad about wallet.dat that it had to be replaced with a new format?

In wallet.dat, a separate private key is stored for each address (wallet). That is, if you use several addresses of one or several standards at once, a separate private key is generated for each address. By the way, there are already several types of Bitcoin addresses: P2PKH, P2WPKH (bech32), P2SH (Segwit), P2WSH, P2TR (Taproot).

For example, if you send part of the amount from your Bitcoin wallet, the change, by default, will not return to the original address but will be sent to a new address, which is also stored in your wallet.dat. And if you did not write down the private key for this new address in advance, you may lose access to your Bitcoins FOREVER. Because the written-down private key will only give you access to the initial wallet, which will already be empty.

Precisely because of this, many people store not the private key but the wallet.dat file itself with its password to avoid finding themselves in such a situation.

As you might have guessed, the descriptor wallet solves this problem because by knowing one descriptor, you can gain access to all wallets (addresses) at once, regardless of their format. This greatly simplifies the backup and recovery of a Bitcoin wallet.

In addition to this pressing problem, descriptor wallets also allow for configuring smart contracts using scripts and creating multisignature BTC wallets.

The importprivkey command no longer works

Users of Bitcoin Core are already facing the issue that the importprivkey command for importing a private key into their Bitcoin Core wallet no longer works, as this format is no longer supported. To import your private key into modern versions of Bitcoin Core, you need to use descriptor commands:

 

For legacy (P2PKH) format: importdescriptors '[{ "desc":"pkh(PRIVATE_KEY)#CHECKSUM", "timestamp":0 }]'

For Bech32 (Native SegWit) format: importdescriptors '[{ "desc":"wpkh(PRIVATE_KEY)#CHECKSUM", "timestamp":0 }]'  

 

The CHECKSUM is generated using the command:

 

getdescriptorinfo

 

You can check which wallets were imported using the command:

 

listreceivedbyaddress 1 true

 

The migratewallet command

If you stored the wallet.dat file rather than individual private keys, you can use the migratewallet

 

bitcoin-cli migratewallet ("new_wallet_name") (bech32)

 

If your wallet.dat is protected by a password, you need to unlock it first:

 

bitcoin-cli -rpcwallet=old_wallet walletpassphrase "your_password" 300

 

With this single command, all your funds will be transferred to a new bech32 format address (starting with bc1q), and you will have to pay a network fee for this transfer.

After migrating to a descriptor wallet, the wallet.dat file is renamed to wallet.dat.bak.

Conclusion: The development of Bitcoin is not standing still, as it might seem at first glance, and sometimes innovations affect even such basic things as the method of storing private keys, which is important for everyone using Bitcoin Core as a wallet to know. The decision to switch to a descriptor wallet now is up to you, as all funds will be transferred to a Bech32 format address, which some wallets, services, or exchanges may not yet support.