Author

Topic: A basic question about the pre-generated addresses in wallet.dat (Read 570 times)

pf
full member
Activity: 176
Merit: 105
Here is my question: Were these pre-generated addresses (and the corresponding private keys) created BEFORE the encryption, or AFTER the encryption?
after.

source code responsible for this behavior: https://github.com/bitcoin/bitcoin/blob/086cb336cd8ac0b2a7ad9ff0544c014569c7db38/src/wallet/wallet.cpp#L557
To make sure I understand things correctly, if I do this:

1. Launch Bitcoin Core for the first time (with an unencrypted wallet).
2. Generate 3 receiving addresses.
3. Encrypt wallet and restart Bitcoin Core.
4. Generate 5 receiving addresses.

This means that the first 3 private keys were exposed unencrypted to the hard drive, but the second 5 private keys were only written out encrypted to the hard drive. Am I right?

Yes, those keys that have been shown to the user before the encryption will still be part of the wallet.dat and thus stored w/o encryption. Those that have been generated afterwards will never be stored without the encryption (well unless you export them manually or something similar).
Thank you. Appreciated!
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
Here is my question: Were these pre-generated addresses (and the corresponding private keys) created BEFORE the encryption, or AFTER the encryption?
after.

source code responsible for this behavior: https://github.com/bitcoin/bitcoin/blob/086cb336cd8ac0b2a7ad9ff0544c014569c7db38/src/wallet/wallet.cpp#L557
To make sure I understand things correctly, if I do this:

1. Launch Bitcoin Core for the first time (with an unencrypted wallet).
2. Generate 3 receiving addresses.
3. Encrypt wallet and restart Bitcoin Core.
4. Generate 5 receiving addresses.

This means that the first 3 private keys were exposed unencrypted to the hard drive, but the second 5 private keys were only written out encrypted to the hard drive. Am I right?

Yes, those keys that have been shown to the user before the encryption will still be part of the wallet.dat and thus stored w/o encryption. Those that have been generated afterwards will never be stored without the encryption (well unless you export them manually or something similar).
pf
full member
Activity: 176
Merit: 105
Here is my question: Were these pre-generated addresses (and the corresponding private keys) created BEFORE the encryption, or AFTER the encryption?
after.

source code responsible for this behavior: https://github.com/bitcoin/bitcoin/blob/086cb336cd8ac0b2a7ad9ff0544c014569c7db38/src/wallet/wallet.cpp#L557
To make sure I understand things correctly, if I do this:

1. Launch Bitcoin Core for the first time (with an unencrypted wallet).
2. Generate 3 receiving addresses.
3. Encrypt wallet and restart Bitcoin Core.
4. Generate 5 receiving addresses.

This means that the first 3 private keys were exposed unencrypted to the hard drive, but the second 5 private keys were only written out encrypted to the hard drive. Am I right?
legendary
Activity: 2058
Merit: 1452
Here is my question: Were these pre-generated addresses (and the corresponding private keys) created BEFORE the encryption, or AFTER the encryption?
after.

source code responsible for this behavior: https://github.com/bitcoin/bitcoin/blob/086cb336cd8ac0b2a7ad9ff0544c014569c7db38/src/wallet/wallet.cpp#L557
pf
full member
Activity: 176
Merit: 105
I launched a fresh Bitcoin Core 0.11.0 (bitcoin-qt) from a new (offline) Ubuntu Linux installation.

Then I encrypted my wallet with a passphrase and restarted bitcoin-qt.

Then I went into "Receive" and clicked "Request payment". I now saw a new receiving address added to the list.

Here is the thing: I was not asked to decrypt my wallet before adding that new receiving address. This must mean that Bitcoin Core had already pre-generated this address for me. (Other sources seem to mention that the program pre-generates 100 addresses, one benefit of which is to make backups more stable.)

Here is my question: Were these pre-generated addresses (and the corresponding private keys) created BEFORE the encryption, or AFTER the encryption?

This is a pretty important question IMO. If the pre-generated addresses were created before the encryption, it means that the private keys have already been written unencrypted to the hard drive. This is a security risk I have to take into account.
Jump to: