Title: A basic question about the pre-generated addresses in wallet.dat Post by: pf on July 14, 2015, 08:02:28 PM 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. Title: Re: A basic question about the pre-generated addresses in wallet.dat Post by: grue on July 14, 2015, 08:12:15 PM 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 Title: Re: A basic question about the pre-generated addresses in wallet.dat Post by: pf on July 14, 2015, 08:43:04 PM 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 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? Title: Re: A basic question about the pre-generated addresses in wallet.dat Post by: shorena on July 14, 2015, 08:49:31 PM 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 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). Title: Re: A basic question about the pre-generated addresses in wallet.dat Post by: pf on July 14, 2015, 08:56:07 PM 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 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). |