<ol>
<li><p>Yes, your "wallet.dat" contains all your keys, and when you make new keys then they will be added to your wallet.dat. If you encrypt your wallet.dat, then all keys in it will be encryptet and all keys added to it will also be encryptet.</p></li>
<li><p>Your founds is not stored in your wallet.dat. The founds are stored in the blockchain (which everyone can download via a huge p2p network).</p></li>
<li><p>Yes. Your wallet.dat only contain the private keys to spend coins. Everyone can at all time send you coins (whether your connected to the internet or not).</p></li>
<li><p>No. The USB stick will only be able to spend coins send to the first 3 addresses (as the USB stick's wallet.dat will only contain private keys to the first 3 addresses).</p></li>
<li><p>As long as your client has the longest blockchain, then coins send to you can NEVER be removed again (unless someone spends them, with the private key only you know). However note that coins can first be "trusted", when there is enough confirms ("0 confirms" just means that someone has sent you a transaction, but it will first be "trustable" when it's included in the blockchain and enough blocks confirms that the blockchain will never be forked under your transaction. But usually 6 confirms should be enough).</p></li>
<li><p>Type your address on a trusted website, e.g. <a href="https://blockchain.info/" rel="nofollow">https://blockchain.info/</a> and look at the balance. Some clients support "watch-only" addresses (they only store your bitcoin address and not your private key), but I don't think Bitcoin-QT supports this (yet).</p></li>
<li><p>I don't know much about litecoin, but most of the "public/private key" stuff, apply to all cryptocoins (e.g. you can watch an address without storing the private key, etc).</p></li>
</ol>

CC BY-SA 3.0
2013-03-06T20:46:18.763Z
Thank you :D That all makes sense to me apart from answer 5 where you say 'As long as your client has the longest blockchain,'. What does this mean and how can I check/ensure that my client has the longest blockchain?
user991987
CC BY-SA 3.0
2013-03-06T21:06:05.470Z
Supposed an attacker controls all your internet. What he can do, is to block all bitcoin traffic between you and the rest of the bitcoin network (so you can't see the longest blockchain). Then the attacker creates a transaction where he sends some bitcoins to you and begin mining a block with this transaction in it. At some point he will generate a valid block and send it to you. From your point of view, the longest blockchain will contain a "1 confirmed", so you believe that the attacker has sent you some bitcoins.
Nicolai
CC BY-SA 3.0
2013-03-06T21:11:09.040Z
So now you send the attacker some dollars/goods (believing that the attacker is a good guy that have paid you). After this, the attacker give you full access to the internet and you can see that the "attacker mined" block is not valid (not in the longest chain), but you have already send him dollars/goods. To prevent against this, your client can calculate how many blocks it *should* see (e.g one block pr 10 minutes). If at sometime the block generation slows too much down, your client will warn you that something is wrong. And the attacker can't alone generate blocks fast enough to avoid this
Nicolai
CC BY-SA 3.0
2013-03-07T00:34:00.340Z
One thing I forgot about #4: By default Bitcoin-QT creates a "key pool" ( https://en.bitcoin.it/wiki/Key_pool ) with 100 addresses in it, so when you click "generate address" you actually wont generate an new address, you will just select an address from the key pool. So old backups can recover "new" keys, but you should ofc still be very careful not to delete your wallet without making sure you have an updated backup :-)
Nicolai
CC BY-SA 3.0
2013-03-06T20:26:33.930Z
2013-03-06T20:26:33.930Z
Nicolai
<p>I am trying to understand Bitcoin QT. Sorry for the questions.</p>

<ol>
<li><p>If I create two new addresses, then encrypt my wallet and then create a third new address after the encryption process, are all three new addresses encrypted and safe to use?</p></li>
<li><p>If I then copy the wallet.dat file to usb sticks and delete the wallet.dat file on my laptop, are the funds on the usb stick still accessible? On all three addresses?</p></li>
<li><p>Can I then continue sending money to these addresses? Even thought the wallet isn't connected to the internet?</p></li>
<li><p>Imagine I have a copy of the wallet.dat file on a usb stick. If I generate a 4th address on my laptop, and then destroy the laptops wallet.dat file, will funds I send to the 4th address still go into the wallet.dat copy  on the usb stick which was made before I created the 4th address?</p></li>
<li><p>If I can see coins transfered to my wallet and confirmed, should I bother setting up a second wallet on my other computer and doing a test transaction with my new funds? Or can I safely assume the coins are ok?</p></li>
<li><p>Is there a gauranteed fail safe way to check the balance in an address without hooking up the wallet.dat file to my client? I want to keep my wallet.dat file offline.</p></li>
<li><p>Are the answers to the above the same for Litecoin QT?</p></li>
</ol>

<p>Thanks so much for any guidance  </p>

<bitcoin-core>
Securing a wallet and multiple addresses
user991987
# Securing a wallet and multiple addresses

(Asked by: username_0 on 2013-03-06)

I am trying to understand Bitcoin QT. Sorry for the questions.

1. If I create two new addresses, then encrypt my wallet and then create a third new address after the encryption process, are all three new addresses encrypted and safe to use?
2. If I then copy the wallet.dat file to usb sticks and delete the wallet.dat file on my laptop, are the funds on the usb stick still accessible? On all three addresses?
3. Can I then continue sending money to these addresses? Even thought the wallet isn't connected to the internet?
4. Imagine I have a copy of the wallet.dat file on a usb stick. If I generate a 4th address on my laptop, and then destroy the laptops wallet.dat file, will funds I send to the 4th address still go into the wallet.dat copy on the usb stick which was made before I created the 4th address?
5. If I can see coins transfered to my wallet and confirmed, should I bother setting up a second wallet on my other computer and doing a test transaction with my new funds? Or can I safely assume the coins are ok?
6. Is there a gauranteed fail safe way to check the balance in an address without hooking up the wallet.dat file to my client? I want to keep my wallet.dat file offline.
7. Are the answers to the above the same for Litecoin QT?

Thanks so much for any guidance

**Tags:** bitcoin-core


---

## 1 answers

### Answer by username_1 on 2013-03-06. Score: 1

1. Yes, your "wallet.dat" contains all your keys, and when you make new keys then they will be added to your wallet.dat. If you encrypt your wallet.dat, then all keys in it will be encryptet and all keys added to it will also be encryptet.
2. Your founds is not stored in your wallet.dat. The founds are stored in the blockchain (which everyone can download via a huge p2p network).
3. Yes. Your wallet.dat only contain the private keys to spend coins. Everyone can at all time send you coins (whether your connected to the internet or not).
4. No. The USB stick will only be able to spend coins send to the first 3 addresses (as the USB stick's wallet.dat will only contain private keys to the first 3 addresses).
5. As long as your client has the longest blockchain, then coins send to you can NEVER be removed again (unless someone spends them, with the private key only you know). However note that coins can first be "trusted", when there is enough confirms ("0 confirms" just means that someone has sent you a transaction, but it will first be "trustable" when it's included in the blockchain and enough blocks confirms that the blockchain will never be forked under your transaction. But usually 6 confirms should be enough).
6. Type your address on a trusted website, e.g. <https://blockchain.info/> and look at the balance. Some clients support "watch-only" addresses (they only store your bitcoin address and not your private key), but I don't think Bitcoin-QT supports this (yet).
7. I don't know much about litecoin, but most of the "public/private key" stuff, apply to all cryptocoins (e.g. you can watch an address without storing the private key, etc).

> **Comments:**
> **username_0**: Thank you :D That all makes sense to me apart from answer 5 where you say 'As long as your client has the longest blockchain,'. What does this mean and how can I check/ensure that my client has the longest blockchain?  
> **username_1**: Supposed an attacker controls all your internet. What he can do, is to block all bitcoin traffic between you and the rest of the bitcoin network (so you can't see the longest blockchain). Then the attacker creates a transaction where he sends some bitcoins to you and begin mining a block with this transaction in it. At some point he will generate a valid block and send it to you. From your point of view, the longest blockchain will contain a "1 confirmed", so you believe that the attacker has sent you some bitcoins.  
> **username_1**: So now you send the attacker some dollars/goods (believing that the attacker is a good guy that have paid you). After this, the attacker give you full access to the internet and you can see that the "attacker mined" block is not valid (not in the longest chain), but you have already send him dollars/goods. To prevent against this, your client can calculate how many blocks it *should* see (e.g one block pr 10 minutes). If at sometime the block generation slows too much down, your client will warn you that something is wrong. And the attacker can't alone generate blocks fast enough to avoid this  
> **username_1**: One thing I forgot about #4: By default Bitcoin-QT creates a "key pool" ( https://en.bitcoin.it/wiki/Key_pool ) with 100 addresses in it, so when you click "generate address" you actually wont generate an new address, you will just select an address from the key pool. So old backups can recover "new" keys, but you should ofc still be very careful not to delete your wallet without making sure you have an updated backup :-)  

---

