Bitcoin Core Wallet.dat [best] Jun 2026
The Bitcoin Core wallet.dat : A Complete Guide to Your Keys, Your Coins, Your File If you run a full node with Bitcoin Core, you have a file called wallet.dat . It looks innocent—just another data file in a folder. But inside that file lies the ultimate sovereignty of your bitcoin: the private keys that control your funds. Lose this file, lose your bitcoin. Let someone else read it, lose your bitcoin. Corrupt it, lose your bitcoin. Understanding wallet.dat isn't just for developers—it’s for anyone serious about self-custody on the Bitcoin network. What Is wallet.dat ? wallet.dat is the default wallet file for Bitcoin Core (formerly Bitcoin-Qt). Unlike lightweight or web wallets that outsource key management, Bitcoin Core stores everything locally. The file is an SQLite database (since v22.0) or a Berkeley DB (BDB) file in older versions. It contains:
Private keys (for receiving and spending) Public keys & addresses Transaction metadata (labels, timestamps, etc.) Keypool (pre-generated keys for future use) Wallet transactions (mined or received) Spent status (to avoid double-spending) Master key if encrypted
Crucially, wallet.dat does not store the blockchain. It stores your slice of the blockchain—only transactions that involve your addresses. File Locations by OS | OS | Path | |----|------| | Windows | %APPDATA%\Bitcoin\ | | macOS | ~/Library/Application Support/Bitcoin/ | | Linux | ~/.bitcoin/ | The default filename is wallet.dat . Multi‑wallet support (introduced in v0.15.0) allows named wallets, e.g., watchingonly.dat , coldstorage.dat . Encryption: The First Line of Defense Bitcoin Core supports wallet encryption via the encryptwallet RPC command. Encryption uses AES-256-CBC with a key derived from your passphrase using OpenSSL’s EVP_BytesToKey (with SHA-512). What encryption protects against:
Theft of the wallet.dat file while your node is offline. Physical access to your machine (if the wallet is locked). Bitcoin Core Wallet.dat
What encryption does NOT protect against:
Keyloggers, clipboard sniffers, or memory scrapers while the wallet is unlocked. Malware that runs dumpwallet while the wallet is decrypted.
Best practice: Run Bitcoin Core on an air‑gapped, dedicated machine for cold storage, or use the wallet only as a hot wallet with modest funds. The Keypool: Pre‑generating Keys One of the most misunderstood parts of Bitcoin Core is the keypool (default 1000 keys). When you request a “new address,” Bitcoin Core doesn’t generate a fresh key on the spot. It pulls the next unused key from the keypool. Why? To allow robust backups: if you back up wallet.dat today, you can generate up to 1000 new addresses tomorrow and still recover funds sent to them from that old backup. Keypool management: The Bitcoin Core wallet
keypoololdest shows the timestamp of the oldest key in the pool. keypoolsize shows how many fresh keys remain. Use keypoolrefill to top up the pool.
Without a keypool, a backup taken before generating an address would be useless for recovering funds sent to that address. Backing Up wallet.dat – The Right Way Golden rule: Always shut down Bitcoin Core cleanly before copying wallet.dat . A live database copy may be corrupted. Steps for a safe backup:
bitcoin-cli stop (or use -stop in GUI) Wait for the process to fully exit. Copy wallet.dat to external media (USB, encrypted cloud, etc.). Restart Bitcoin Core. Lose this file, lose your bitcoin
For encrypted wallets, back up the encrypted file. The passphrase remains the critical secret. Do not rely on a single backup. Corrosion, bitrot, and device failure are real. Use the 3-2-1 rule : three copies, two media types, one offsite. Restoring from wallet.dat
Install Bitcoin Core on the target machine. Stop the node. Replace the existing wallet.dat (or place it in a new wallet directory). Restart Bitcoin Core. The node will rescan the blockchain for transactions involving your keys. This can take hours.
