Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: fasttimes on September 15, 2021, 08:17:38 PM



Title: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 15, 2021, 08:17:38 PM
super noob here. i have set up linux ubuntu on an old laptop. i have installed bitcoin core, verified, and DL'd the blockchain this past week (most up to date version). once the blockchain downloaded, i shut down btc core and the laptop and disconnected from the internet (for security?). then i restarted the laptop and btc core and created two wallets in btc core and encrypted both wallets and saved/protected the passcode.

I now want to back up these wallets so that i can make copies of the backups and not lose my coins. I have the following questions as i am very unsure how to know for certain if have everything properly backed up and saved.

1) by opening each wallet and selecting "backup wallet", will the file that is created be EVERYTHING i need in the event the laptop crashes or i have restore this wallet to a new computer?

2) I have actually created a backup file already, but the backup file that is created does not seem be a .dat file. when i save it to a USB stick or DVR and look at the file on a windows computer the file type says "21 file". is that correct or is the back up more than just the .dat which would be contained in the overall backup file?

3) is there a way, to confirm the back up i have made will actually work if it is actually needed? meaning, is there a way to test my backup?

4) my understanding is that if the BTC core wallet has "HD" in the bottom right, i don't need to dump the private keys, as the backup/wallet.dat file will have all that info. is this correct or do i need to make a physical backup of every private key as well.

thank you ahead of time. i really have searched for answers ahead of time, but i don't know what i don't know and not being able to recover things makes me extremely nervous.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: BitMaxz on September 15, 2021, 11:09:29 PM
All question seems a bit the same they are all talks about the backup file.

What do I want to know is if what folder did you get the backup file?

The wallet file should have extension .dat  unless if your Windows Computer hide all extension that is why it doesn't show .dat file.
To find the bitcoin core wallet.dat file you can find the right folder under this path below

Code:
~/.bitcoin/

You should use this command below to see the file extension

Code:
ls -a
Then look for wallet.dat the name it was created by default


If you want to verify your backup you must have another device offline and install bitcoin core then import it there so that you can check if the addresses there are the same as what you see on the original wallet.
And I think it would be better if you could also dump the private keys of all addresses since you run it offline then it is safe to dump the private keys of each wallet you created.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 16, 2021, 12:15:53 AM
i did not go into any folder to get the wallet.dat file, i simply used the bitcoin-qt interface and used file > backup wallet and then saved that file to the documents folder, then copied to a USB stick.

i understand i can use the terminal and commands but im not familiar with doing that.

however, i suppose that is how i need to do it to make absolutely sure i have the right file/files. If i have two wallets created/set up, will each wallet have its own wallet.dat file? if so, how do i tell them apart? sorry, i know these are likely very basic questions.

getting a second computer to restore the backups sounds like a good idea as well. that will ensure i did everything correctly if i can restore to a new set up.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: nc50lc on September 16, 2021, 03:46:32 AM
Quote from: fasttimes
4) my understanding is that if the BTC core wallet has "HD" in the bottom right, i don't need to dump the private keys, as the backup/wallet.dat file will have all that info. is this correct or do i need to make a physical backup of every private key as well.
Yes, the backup of the wallet files are enough but make sure that the backups are made after you've encrypted the wallet files.
That's because it'll generate a new "hdseed" after encrypting the wallet, making the old backups obsolete.

2) I have actually created a backup file already, but the backup file that is created does not seem be a .dat file. when i save it to a USB stick or DVR and look at the file on a windows computer the file type says "21 file". is that correct or is the back up more than just the .dat which would be contained in the overall backup file?
Windows has an option to hide/show the file extension but since it says "Type: 21 file", it means that the extension isn't ".dat" which shouldn't be the case with "File->Backup Wallet".
You can display the extension in Windows in the 'file explorer' menu "View->File Name Extensions".

however, i suppose that is how i need to do it to make absolutely sure i have the right file/files. If i have two wallets created/set up, will each wallet have its own wallet.dat file? if so, how do i tell them apart? sorry, i know these are likely very basic questions.
Yes, 1 wallet = 1 backup with ".dat" extension.
You can set a name when you use "File->Backup wallet" but make sure that the correct wallet is selected in the "Wallet:" drop-down menu at the right,
you can also set a wallet name during wallet creation (in the later versions). IMO, naming those differently is enough to tell them apart from each other.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 16, 2021, 02:32:22 PM
Thank you both very much.

for whatever reason when i backed up the wallets (file>backup wallet) what was created and visible was a single file that was not a .dat file. later when looking at the back up on a windows computer i did find a folder called .trash and in it was the .dat file for the wallet i backed up up "walletname".dat. so at least i know what im looking for now.

this is all in ubuntu, which i am completely new to, so perhaps it was hidden folder which can be made visible with a setting change. either way, i think i have my plan now and will know how to test to make sure it works.

one last question that is a bit different. the only way to have one private key/public key pair for a particular wallet is to only have a single receive address, correct? i plan to set up a temporary wallet and then a hodl wallet for long term saving. for the hodl wallet, only having one address and one public/private key pair would be ok and simpler to keep track of if my short and medium term plan is to only fill the wallet and not spend, yes?

thanks again for the responses.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 16, 2021, 05:03:30 PM
I now want to back up these wallets so that i can make copies of the backups and not lose my coins. I have the following questions as i am very unsure how to know for certain if have everything properly backed up and saved.
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). I create all my backups on a file system level, 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.
Quote from: bitcoin-qt --help
Code:
  -wallet=<path>
       Specify wallet path to load at startup. Can be used multiple times to
       load multiple wallets. Path is to a directory containing wallet
       data and log files. If the path is not absolute, it is
       interpreted relative to <walletdir>. This only loads existing
       wallets and does not create new ones. For backwards compatibility
       this also accepts names of existing top-level data files in
       <walletdir>.

super noob here
Are you also a "super n00b" on Ubuntu? If so, you should make sure to understand what you're doing before funding the wallet with any substantial amount.

Quote
i shut down btc core and the laptop and disconnected from the internet (for security?)
Why? Cold storage is only useful if you don't go online again, but there's not much use for Bitcoin Core offline.

i understand i can use the terminal and commands but im not familiar with doing that.
The terminal is the best thing Linux has to offer: I often use it, even though there's a graphical alternative. Once you understand the basics, it's fast and powerful.

when looking at the back up on a windows computer i did find a folder called .trash and in it was the .dat file for the wallet i backed up up "walletname".dat. so at least i know what im looking for now.

this is all in ubuntu, which i am completely new to, so perhaps it was hidden folder which can be made visible with a setting change.
Ubuntu will show this as Trash in the file manager, with a trash bin icon. The real question is how you managed to trash your backup without knowing it!

Quote
one last question that is a bit different. the only way to have one private key/public key pair for a particular wallet is to only have a single receive address, correct? i plan to set up a temporary wallet and then a hodl wallet for long term saving. for the hodl wallet, only having one address and one public/private key pair would be ok and simpler to keep track of if my short and medium term plan is to only fill the wallet and not spend, yes?
If your "hold wallet" is cold storage, for instance a paper wallet, a single address is indeed easy. But it's better for privacy to use a new address each time, and it's less risky to use a different paper wallet each time you add funds. That way you don't expose all your funds when you want to send a small part of it later on.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 16, 2021, 07:03:55 PM

Are you also a "super n00b" on Ubuntu? If so, you should make sure to understand what you're doing before funding the wallet with any substantial amount.

Yes, this is the first time i am using ubuntu solely for the purposes of trying to run a node to take custody of btc myself. im trying to learn. seems like this is the method least reliant on others, but it seems fairly cumbersome and tedious.


Ubuntu will show this as Trash in the file manager, with a trash bin icon. The real question is how you managed to trash your backup without knowing it!

yes, great question. i have no idea. i simply used the file>back up and then copied those files to a flashdrive. thats why im on here, trying to figure all this out. its not all exactly straightforward, but i appreciate folks responding here.


If your "hold wallet" is cold storage, for instance a paper wallet, a single address is indeed easy. But it's better for privacy to use a new address each time, and it's less risky to use a different paper wallet each time you add funds. That way you don't expose all your funds when you want to send a small part of it later on.

but isn;t a single address how these hardware wallets work? im way more nervous about having 50 different address and key pairs and losing 1 or more than keeping up with and securing  a single address and key pair. but again, im trying to figure this all out and not lose any coin in the process.


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). I create all my backups on a file system level, 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.

so i can test the wallet backup in btc core without having to have a second computer running core?



Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: khaled0111 on September 16, 2021, 08:49:36 PM
but isn;t a single address how these hardware wallets work? im way more nervous about having 50 different address and key pairs and losing 1 or more than keeping up with and securing  a single address and key pair. but again, im trying to figure this all out and not lose any coin in the process.
Bitcoin core wallets are deterministic wallets, meaning that all key pairs are derived from one seed. Therefore, you only need to back up is the wallet file and every time you restore that wallet you will get the same addresse. So, you don't have to back up each key pair individually.

Quote
so i can test the wallet backup in btc core without having to have a second computer running core?
Yes, just open the back up file and see if you get the same wallet.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 16, 2021, 09:03:55 PM
thank you all very much for the responses. i just need to make absolutely sure i have the wallet.dat file/files for each wallet and several copies and i should be good to go. then i can test each back up to ensure its correct.

how often is it recommended to make a new back up copy of the wallet.dat file?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: BitMaxz on September 16, 2021, 10:25:45 PM
how often is it recommended to make a new back up copy of the wallet.dat file?

2 to 3 times to make sure that you created a backup copy and make sure to put them in a separate folder if you have extra USB/HDD put it there and make sure to don't connect it to any device connected to the internet and test it 2 to 3 times to confirm that you have your original wallet.

I recently test to make a backup on the GUI using file>backup wallet it pops up and asks to give a wallet name after generated a wallet file it has a .dat file at the end so it means that on the Linux it doesn't show .dat at the end of the wallet file generated without using ls -a command it won't show the file extension.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: nc50lc on September 17, 2021, 03:25:31 AM
one last question that is a bit different. the only way to have one private key/public key pair for a particular wallet is to only have a single receive address, correct? i plan to set up a temporary wallet and then a hodl wallet for long term saving. for the hodl wallet, only having one address and one public/private key pair would be ok and simpler to keep track of if my short and medium term plan is to only fill the wallet and not spend, yes?
Will the funds be coming from a single source?
If yes, then I think it's fine to use a single address for the "hodl wallet", eg. ExchangeA -> hodl wallet's address;
but not if it's coming from multiple sources like your "temporary wallet" and exhanges, because you might end up linking those sources to each other and to your hodl wallet.

how often is it recommended to make a new back up copy of the wallet.dat file?
If says "HD" at the lower-right (says "HD key generation is enabled" when hovered), your current backup is enough to restore the newly derived addresses.
But if you want to keep the labels updated, update your backup as well.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 17, 2021, 08:13:19 AM
If your "hold wallet" is cold storage, for instance a paper wallet, a single address is indeed easy. But it's better for privacy to use a new address each time, and it's less risky to use a different paper wallet each time you add funds. That way you don't expose all your funds when you want to send a small part of it later on.
but isn;t a single address how these hardware wallets work? im way more nervous about having 50 different address and key pairs and losing 1 or more than keeping up with and securing  a single address and key pair.
Most (if not all) hardware wallets use more than one address. You don't need to backup each individual private key, they're all derived from the same (24) mnemonic seed words.
But that has nothing to do with Bitcoin Core.

Quote
so i can test the wallet backup in btc core without having to have a second computer running core?
It depends: it doesn't hurt to be overly thorough and start from scratch to see if you can restore everything from just the backup you made on a USB stick. I've actually done that years ago, but I don't do it anymore. It helped me believe my backup was enough :)
Note that a few more backups is better, just in case the USB stick breaks (after a while). I prefer to use different brands.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 17, 2021, 01:30:29 PM
thank you all. this is very helpful.


It depends: it doesn't hurt to be overly thorough and start from scratch to see if you can restore everything from just the backup you made on a USB stick. I've actually done that years ago, but I don't do it anymore. It helped me believe my backup was enough :)
Note that a few more backups is better, just in case the USB stick breaks (after a while). I prefer to use different brands.

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?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: BitMaxz on September 17, 2021, 01:54:59 PM
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
https://i.imgur.com/qVM9JcG.png

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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 17, 2021, 02:16:38 PM
and there should be address even if all ive done is create the wallet(s) and not used/received any btc to them?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 17, 2021, 03:00:35 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 17, 2021, 08:58:13 PM
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?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: nc50lc on September 18, 2021, 04:41:27 AM
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).


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 18, 2021, 06:25:32 AM
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.

Quote
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?
Yes. Note that you shouldn't delete your wallet.dat to test the backup. Just move or rename it.
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 18, 2021, 01:20:30 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 18, 2021, 02:01:14 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: ABCbits on September 19, 2021, 09:49:27 AM
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


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 19, 2021, 11:35:10 AM
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 ;)


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 21, 2021, 03:09:09 PM
again, thank you all. this has all helped a lot.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 22, 2021, 02:30:55 AM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 22, 2021, 03:04:03 AM
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?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: nc50lc on September 22, 2021, 07:21:15 AM
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 (https://en.bitcoin.it/wiki/Data_directory#Default_Location)
Exclude the "wallets" folder if you do not want to copy the wallets.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 23, 2021, 06:32:21 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 23, 2021, 06:50:01 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 23, 2021, 08:32:14 PM
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?


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: LoyceV on September 23, 2021, 08:57:51 PM
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)


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: fasttimes on September 23, 2021, 09:01:14 PM
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.


Title: Re: bitcoin core wallet backup and wallet.dat file question. how to confirm?
Post by: HCP on September 24, 2021, 12:57:05 PM
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.