Skip to content

rpc: encryptwallet help, mention HD seed rotation and backup requirement - #28980

Merged
achow101 merged 1 commit into
bitcoin:masterfrom
furszy:2023_rpc_wallet_encryptwallet
Dec 6, 2023
Merged

achow101 merged 1 commit into
bitcoin:masterfrom
furszy:2023_rpc_wallet_encryptwallet

Conversation

@furszy

@furszy furszy commented Dec 1, 2023

Copy link
Copy Markdown
Member

Small and simple PR, updating the encryptwallet help message.

Better to notify users about the HD seed rotation and the new
backup requirement before executing the encryption process.
Ensuring they are prepared to update previous backups and
securely safeguard the updated wallet file.

@DrahtBot

DrahtBot commented Dec 1, 2023 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK S3RK, achow101
Concept ACK luke-jr
Stale ACK pablomartin4btc, jonatack

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Comment thread src/wallet/rpc/encrypt.cpp Resolved
@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch from 6739760 to 40a5117 Compare December 1, 2023 01:20

@MarnixCroes MarnixCroes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

Comment thread src/wallet/rpc/encrypt.cpp Resolved

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 40a5117c020e6ecfc5b57909900eb7afb8a486d9

Comment thread src/wallet/rpc/encrypt.cpp Resolved
@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch from 40a5117 to 30983e4 Compare December 2, 2023 13:08

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re ACK 30983e4e30a136ce7d2efc3639f0c17ed89ea38b

Comment thread src/wallet/rpc/encrypt.cpp Resolved

@jonatack jonatack left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, suggest the doc: prefix or rpc, doc: for the pull title

Comment thread src/wallet/rpc/encrypt.cpp Resolved
Comment thread src/wallet/rpc/encrypt.cpp Resolved
@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch from 30983e4 to e26c4aa Compare December 4, 2023 22:29
@furszy

furszy commented Dec 4, 2023

Copy link
Copy Markdown
Member Author

Updated per feedback. Thanks everyone.

@luke-jr

luke-jr commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

utACK

Comment thread src/wallet/rpc/encrypt.cpp Resolved
@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch 2 times, most recently from 5f2ff09 to e6b9a6d Compare December 5, 2023 19:49

@furszy furszy left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated per feedback. Thanks.
Applied #28980 (comment) suggestions.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reACK e6b9a6dba79144cbe77c59515541f9019d1db4b5

@DrahtBot
DrahtBot requested review from jonatack and luke-jr December 5, 2023 19:59

@jonatack jonatack left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK e6b9a6dba79144cbe77c59515541f9019d1db4b5

This change would result in the following help:

$ ./src/bitcoin-cli -signet help encryptwallet
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.
** IMPORTANT **
For security reasons, the encryption process will generate a new HD seed, resulting in the creation of a fresh set of active descriptors. Therefore, it is crucial to securely back up the newly generated wallet file using the backupwallet RPC.

If you agree and/or need to retouch, maybe do

-                "For security reasons, the encryption process will generate a new HD seed, resulting in the creation of a fresh set of active descriptors. "
-                "Therefore, it is crucial to securely back up the newly generated wallet file using the backupwallet RPC.\n",
+                "For security reasons, the encryption process will generate a new HD seed, resulting\n"
+                "in the creation of a fresh set of active descriptors. Therefore, it is crucial to\n"
+                "securely back up the newly generated wallet file using the backupwallet RPC.\n",

for a more harmonious output

$ ./src/bitcoin-cli -signet help encryptwallet
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.
** IMPORTANT **
For security reasons, the encryption process will generate a new HD seed, resulting
in the creation of a fresh set of active descriptors. Therefore, it is crucial to
securely back up the newly generated wallet file using the backupwallet RPC.

Also, should we change this as well?

                 },
@@ -271,7 +272,7 @@ RPCHelpMan encryptwallet()
         throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
     }
 
-    return "wallet encrypted; The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.";
+    return "wallet encrypted; The keypool has been flushed and a new HD seed was generated. You need to make a new backup with the backupwallet RPC.";

@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch from e6b9a6d to 477c51f Compare December 5, 2023 21:45
Better to notify users about the HD seed rotation and the new
backup requirement before executing the encryption process.
Ensuring they are prepared to update previous backups and
securely safeguard the updated wallet file.

Co-authored-by: jonatack <[email protected]>
@furszy
furszy force-pushed the 2023_rpc_wallet_encryptwallet branch from 477c51f to ca09415 Compare December 5, 2023 21:47
@furszy

furszy commented Dec 5, 2023

Copy link
Copy Markdown
Member Author

Tackled both points. Thanks @jonatack.

@S3RK

S3RK commented Dec 6, 2023

Copy link
Copy Markdown
Contributor

ACK ca09415

@MarnixCroes MarnixCroes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack ca09415

@willcl-ark

Copy link
Copy Markdown
Member

ack ca09415

@achow101

achow101 commented Dec 6, 2023

Copy link
Copy Markdown
Member

ACK ca09415

@achow101
achow101 merged commit 25d23e6 into bitcoin:master Dec 6, 2023
@furszy
furszy deleted the 2023_rpc_wallet_encryptwallet branch December 6, 2023 15:44
@jonatack

jonatack commented Dec 6, 2023

Copy link
Copy Markdown
Member

Post-merge ACK

@bitcoin bitcoin locked and limited conversation to collaborators Dec 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants