3

As mentioned in the bitcoin-cli document for encryptwallet command, bitcoin daemon will shut down after encrypting a new or unencrypted wallet. My question is about the reason for shutting the node down?

Also, I want to create another bitcoin wallet and it's very strange if I need to start after adding a new wallet. this pull request tried to remove shutdown after encrypting a wallet. is it safe? and what's the best way to deal with this problem?

encryptwallet "passphrase"

Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing

will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.

2

This behaviour has been resolved by 12493. As stated by Andrew Chow in the pull request, this was previously done to:

...prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted here. This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation.

To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote this script to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine).

As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.