Pages:
Author

Topic: bitcoin core wallet backup and wallet.dat file question. how to confirm? (Read 353 times)

HCP
legendary
Activity: 2086
Merit: 4363
When you "encrypt the wallet.dat", you're not actually doing a full file encryption. You are only encrypting certain records in the database file (for instance, the private keys, seed etc).

Other records like public keys, addresses etc are not encrypted. This is why you can start Bitcoin Core and load a wallet file without the wallet password. The password is only required for any actions that require the private keys to be decrypted (signing a transaction, signing a message, dumping private keys etc)

There are other wallets that do use a full file encryption option... Electrum is an example of this. If the full file encryption option is used, you cannot open the wallet at all without the wallet password.
newbie
Activity: 24
Merit: 21
that thought hit me after i posted that question, but good to confirm. thank you all so much. i am genuinely thankful for you all taking the time to answer my questions. this had helped me a lot.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
there was never a point at which i was asked for the passcode. i did encrypt the wallets before i backed them up. is that normal?
The password is for sending Bitcoin, not for viewing addresses. If you try for instance to dump a private key, it won't work without entering the password.

From Bitcoin Core Console:
Code:
dumpprivkey "address"

Reveals the private key corresponding to 'address'.
Then the importprivkey can be used with this output

Arguments:
1. address    (string, required) The bitcoin address for the private key

Result:
"str"    (string) The private key

Examples:
> bitcoin-cli dumpprivkey "myaddress"
> bitcoin-cli importprivkey "mykey"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "dumpprivkey", "params": ["myaddress"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
 (code -1)
Code:
walletpassphrase "passphrase" timeout

Stores the wallet decryption key in memory for 'timeout' seconds.
This is needed prior to performing transactions related to private keys such as sending bitcoins

Note:
Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock
time that overrides the old one.

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).

Result:
null    (json null)

Examples:

Unlock the wallet for 60 seconds
> bitcoin-cli walletpassphrase "my pass phrase" 60

Lock the wallet again (before 60 seconds)
> bitcoin-cli walletlock

As a JSON-RPC call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "walletpassphrase", "params": ["my pass phrase", 60]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
 (code -1)
newbie
Activity: 24
Merit: 21
thank you.

finally got around to testing the backups and they work. was able to confirm the same receive addresses showed up. however, there was never a point at which i was asked for the passcode. i did encrypt the wallets before i backed them up. is that normal?
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
seems easier/faster to just copy that over instead of downloading it all again.
As long as you trust the source, you can do that. Don't forget the chainstate directory.
newbie
Activity: 24
Merit: 21
no, i meant the blockchain data (400 gigs or whatever) on the initial download. seems easier/faster to just copy that over instead of downloading it all again.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
also, is there a way to back up the blockchain info and save those so i don't have to download the entire thing each time i set up a node?
"Blockchain info"? You're not talking about the online wallet with the same name, right?

For the blockchain and other data, just copy the entire data directory to your other computer (same directory) and it should run fully synced.
The default data directory is in: https://en.bitcoin.it/wiki/Data_directory#Default_Location
Exclude the "wallets" folder if you do not want to copy the wallets.
newbie
Activity: 24
Merit: 21
also, is there a way to back up the blockchain info and save those so i don't have to download the entire thing each time i set up a node?
newbie
Activity: 24
Merit: 21
sorry, had another question i figured id ask here.

i bought a second computer (computer 2) to just load btc core (not DL the whole block chain) and test my back ups. i know some of you said thats not necessary but i figured it doesn't hurt going through all the steps again for familiarity. anyway, once i do that and test the back ups, i may want to use computer 2 to run a full node all the time. currently my plain was to run the first computer to set up my btc core wallets, move btc, and shut it down.

if i restore the wallets on computer 2 to test, should i then remove those back ups and not have a wallet set up on computer 2 at all for security purposes or does it matter since i have back ups and the back ups are encrypted.

sorry if this the question is not clear.
newbie
Activity: 24
Merit: 21
again, thank you all. this has all helped a lot.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Take note the way you exit Bitcoin Core doesn't matter (unless you use command kill), using shortcut Alt+F4 or press "X" on Bitcoin Core window will also show the pop up.
I've enabled "Options > Minimize on close", that's why Wink
legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
how do I ensure Bitcoin core isn’t running when I go to copy the .dat files? I have been using qt and so I can “exit” it and I assume that closes it and stops it running but being new to Ubuntu I’m not sure.
If you exit Bitcoin Core (right mouse on the system tray icon), it gives a popup telling you to wait until it's done. Once the popup disappears, you're good to go.

Take note the way you exit Bitcoin Core doesn't matter (unless you use command kill), using shortcut Alt+F4 or press "X" on Bitcoin Core window will also show the pop up.



But if you're being very careful / paranoid, you could use this command (on terminal) to check if Bitcoin Core is still running.

Code:
ps aux | grep bitcoin

If Bitcoin Core (and other application name which contain "bitcoin") isn't running, the result should look like this.

Code:
user   157604  0.0  0.0   6256  2376 pts/1    S+   09:53   0:00 grep bitcoin
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
how do I ensure Bitcoin core isn’t running when I go to copy the .dat files? I have been using qt and so I can “exit” it and I assume that closes it and stops it running but being new to Ubuntu I’m not sure.
If you exit Bitcoin Core (right mouse on the system tray icon), it gives a popup telling you to wait until it's done. Once the popup disappears, you're good to go.
newbie
Activity: 24
Merit: 21
This has all been very helpful, assuming I am understanding you all. Thank you.

This is another very noob question, but how do I ensure Bitcoin core isn’t running when I go to copy the .dat files? I have been using qt and so I can “exit” it and I assume that closes it and stops it running but being new to Ubuntu I’m not sure.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
when you say "I create all my backups on a file system level" do you mean you are backing up your entire linux? or the entire .bitcoin folder?
I don't care about the system files, usually I just backup my entire home directory. It does help I've symlinked my blocks directory to another drive, so that's easily excluded.

You should never delete a wallet.

You can do that but only if Bitcoin Core isn't running or your backup could be corrupted (with low chance).
That is a slight risk indeed. I make sure I have enough backups anyway.

each wallets are inside a folder with a 'wallet name', then you don't have to rename them in the first place, the wallet name is that folder's name.
I'm old fashioned, still having multiple different .dat files in my .bitcoin directory instead of their own subdirectories.
legendary
Activity: 2618
Merit: 6452
Self-proclaimed Genius
alright. so i found the wallets folder that has folders for both wallets i created. i can open each folder and now locate each "wallet.dat" file for each individual wallet. couple more questions

1) is there any reason i shouldn't just copy the entire "wallets" folder and save it to a few flash drives and burn it to a dvd, instead of ONLY the "wallet.dat" files themselves?
You can do that but only if Bitcoin Core isn't running or your backup could be corrupted (with low chance).

Quote from: fasttimes
2) for each "wallet.dat" file, i can change the name in front of ".dat" and it won't affect the file, but i would need to change it back to "wallet.dat" when try to restore, correct?
If you did the above, and each wallets are inside a folder with a 'wallet name', then you don't have to rename them in the first place, the wallet name is that folder's name.
If you rename the wallet.dat inside it, the folder wont work as a wallet and you won't be able to select it in "Open Wallet" menu.

Otherwise, you can rename the wallet.dat files and put them inside "wallets" folder (but outside of any folders inside)
and it will be available for selection in the "Open Wallet" menu even if they have a different name (your "wallet_name.dat" backups from "File->Backup Wallet" for example).
newbie
Activity: 24
Merit: 21
alright. so i found the wallets folder that has folders for both wallets i created. i can open each folder and now locate each "wallet.dat" file for each individual wallet. couple more questions

1) is there any reason i shouldn't just copy the entire "wallets" folder and save it to a few flash drives and burn it to a dvd, instead of ONLY the "wallet.dat" files themselves?

2) for each "wallet.dat" file, i can change the name in front of ".dat" and it won't affect the file, but i would need to change it back to "wallet.dat" when try to restore, correct?

3)

I've never used Bitcoin Core's File > Backup Wallet... feature, but instead always just manually copy my wallet.dat (ideally when Bitcoin Core is not running). , so I see no reason to make an exception for Bitcoin Core.

It is good practice to actually test your backup before relying on it. Testing is as simple as running it in Bitcoin Core.

when you say "I create all my backups on a file system level" do you mean you are backing up your entire linux? or the entire .bitcoin folder?

and when you say "testing is as simple as running it in bitcoin core" are you saying just change out the existing wallet.dat file with the one in just copied?
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
and there should be address even if all ive done is create the wallet(s) and not used/received any btc to them?
I just tested in a new wallet: "Receiving addresses" is empty.
But if you click the Receive tap in Bitcoin Core, followed by "Create new receiving address", the wallet creates one. And those should be the same if you load a backup on different systems.
newbie
Activity: 24
Merit: 21
and there should be address even if all ive done is create the wallet(s) and not used/received any btc to them?
legendary
Activity: 3472
Merit: 3217
Playbet.io - Crypto Casino and Sportsbook
so if i want to from scratch i get a separate laptop, load btc core on there from a flashdrive (no internet) and then restore the wallet to that new instance of btc core? if the wallet name shows up in btc core, there the backup worked? is that correct?

No, not the wallet name it should be the address on that backup wallet.
So you need to check the addresses under window>receiving addresses new tab will pop up with the list of Bitcoin address.

Sample this one


Under that tab you can see the address on the right side it should be the same after you import the backup file to another laptop.
Pages:
Jump to: