Bitcoin Core #36387 · merged 2026-11-20
Deprecate encryptwallet for existing wallets
Encrypting a wallet after it was created rotates its keys, leaves old key material behind, and can silently retire descriptors you imported. Born-encrypted wallets are now the only recommended path.
Author: davidgumberg · Follows RFC #36027 (achow101) · github.com/bitcoin/bitcoin/pull/36387
Background
Why encrypting after the fact ever existed
- When wallet encryption was introduced, only one wallet could be loaded, and it was created by default prefilled with keys. Encrypting afterward was the only option.
- Today
createwallettakes apassphrase, so a wallet can be encrypted from birth. That has worked for years. encryptwalletrotates keys on purpose: the old keys sat on disk unencrypted, so they're treated as possibly compromised.- That rotation is the source of most of the footguns.
Footgun 1 & 2
Old backups miss new coins; old coins stay exposed
Encryption doesn't move existing coins, and Core makes no attempt to wipe old key material from disk: "difficult and dangerous, and for some SSD's infeasible."
Footgun 3 · issue #26607
Your imported descriptors get swapped out
Funds can end up sent to descriptors the user didn't intend, changing the spending conditions out from under them.
The change
Off by default, behind -deprecatedrpc
// src/wallet/rpc/encrypt.cpp · encryptwallet() + if (!pwallet->chain().rpcEnableDeprecated("encryptwallet")) { + throw JSONRPCError(RPC_METHOD_DEPRECATED, "DEPRECATION WARNING: ... + Start bitcoind with the `-deprecatedrpc=encryptwallet` option ..."); + }
Deprecated
encryptwallet on an existing unencrypted wallet. Errors (code -32) unless started with -deprecatedrpc=encryptwallet; removal planned for a future major release.
Unchanged
Born-encrypted wallets via createwallet … passphrase=, and walletpassphrasechange.
Also updated
doc/managing-wallets.md now recommends born-encrypted wallets; functional tests switched to them.
What to do instead
Start encrypted, then move the coins
$ bitcoin-cli -named createwallet wallet_name="vault" passphrase="…" $ bitcoin-cli -rpcwallet="vault" backupwallet "/safe/place/vault.dat" $ bitcoin-cli -rpcwallet="vault" getnewaddress # send everything from the old wallet to the new address
- Create the new wallet with a passphrase so its keys never hit disk in plaintext.
- Back it up right away, then send the old wallet's funds to it. Encrypting in place would have left them on the exposed keys.
- Treat the old wallet and every backup of it as compromised once it's empty.
The docs recommend createwallet with a passphrase; the sweep and retire steps follow from #36027's point that encryption doesn't move existing funds.
Discussion
Questions for the room
- Is wallet-file encryption worth much at all versus full-disk encryption or a hardware signer?
- Rotate keys on encryption, or keep imported descriptors? Is there any right answer for
encryptwallet? - Who still relies on encrypting after the fact: old scripts, node-in-a-box UIs, tutorials?
- Should Core warn loudly when an unencrypted wallet holds funds?