-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: add require_checksum flag to deriveaddresses #24162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
12300e9 to
48e9935
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept NACK
The purpose of checksum is to ensure the integrity of data and ensure that the data has not been wrongly entered or tampered with.
- Say you use a misspelled private key and used it to generate an address. Any bitcoin received on that address would potentially be unrecoverable and hence burned, which is a potentially very devastating situation.
Though I understand this feature can be helpful for someone regularly transacting with the same key, and hence is familiar with the risk and how to ensure the integrity of the key. Still, the potential risk involved makes this feature not worth the risk.
The descriptor checksum, yes. The WIF format (private key) already has a built-in checksum. See the alternative, where the descriptor checksum is derived using
It would fail. The WIF format includes a checksum. Besides, a WIF privkey that had a typo and still passed the WIF checksum would be a valid private key, and all derived addresses would thus be valid recipients for whoever held that private key. |
I believe |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK |
48e9935 to
8d3c91d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 8d3c91d04931c9a2ad44ca04175944c617fe149e
Note that there are several things we typically put in a descriptor that already have a checksum, namely the xpriv and xpub. The main scenario where it doesn't make sense to use a descriptor checksum, is when you have to generate the descriptor manually. That's clearly the case if you import a WIF from some older software or a paper backup. But there may be watch-only scenario's too, as many wallet software supports the export of a single xpub. That's why I removed the emphasis on "private key" in the help text below.
8d3c91d to
e34c8e1
Compare
|
re-utACK e34c8e1b63628986d496b5f7bb29addac50e459a |
4068e78 to
eea9178
Compare
shaavan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
Changes since my last review:
require_checksumhas been moved from a positional argument to an option. This is done according to the reasoning given by @luke-jr in the above comment, with which I agree.- Slight rewording of the
require_checksumhelp message. I prefer the new wordings as it better explains the working if the checksum is provided.
I agree with the idea of keeping the checksum as an optional part for deriving address than as a mandatory part. Since the WIF already has an in-built checksum, it doesn't necessarily need the redundant checksum part.
These changes allow the user to remove the extra step of getting the checksum before deriving the address. This PR also preserves the old behavior if a user prefers to take the traditional approach of deriving addresses.
I was NOT able to test the working of this RPC successfully. I used the string given in the example to test deriveaddresses, but it failed with the following error.
error: Error parsing JSON: {require_checksum:
Screenshot:
|
@shaavan the JSON object needs to be wrapped with single quotes: |
|
Alternatively you can do |
|
Both of these methods worked correctly: @kallewoof
Do we have any alternatives to the options object? Or some way to bypass this annoying behavior? |
|
@shaavan
Ultimately having an options object rather than stacking on new parameters as we go turns out to be a generally better and more easy to use approach. I think you'll get used to it eventually. :) |
eea9178 to
1375e9f
Compare
There's #15448 |
1375e9f to
5a9587c
Compare
shaavan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 5a9587c5701a4df51c11cea075128ca6e6898681
Changes since my last review:
- Updated RPC help message example. The example command now works correctly.
- Rebased over master.
I was able to compile the updated PR on Ubuntu 20.04 successfully. The example is working perfectly as well.
There's #15448
Let me take a look at it.
5a9587c to
04dfe24
Compare
|
"checked" → "verified". |
29b896b to
1345e8d
Compare
|
re-utACK 1345e8d817acd316b71f23315f0996580253ade3 |
This allows a user to derive the addresses for some privkey without first having to derive the descriptor checksum.
1345e8d to
97a69e2
Compare
Thanks, didn't realize there were failures. Re-ran → passed. |
shaavan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reACK 97a69e2
Changes since my last review:
- “checked” → “verified”. In the context of checksum, “verify” seems like a better choice of words.
- “all addresses” → “the PKH address”, as well as used a
pkh()example instead ofcombo(). I think that is the right approach as this encourages the user to specify which type of address they would like to derive.
This allows a user to derive the addresses for some privkey without first having to derive the descriptor checksum. Github-Pull: bitcoin#24162 Rebased-From: 97a69e2
w0xlt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review ACK 97a69e2
Perhaps require_checksum could be a parameter by itself instead of being the only item in options.
|
Thanks for the review!
The idea is that any new parameters in the future will also go into |
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
1 similar comment
|
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
This allows a user to derive the addresses for some privkey without first having to derive the descriptor checksum. Github-Pull: bitcoin#24162 Rebased-From: 97a69e2
This allows a user to derive the addresses for some privkey without first having to derive the descriptor checksum. Github-Pull: bitcoin#24162 Rebased-From: 97a69e2





This allows a user to derive the addresses for some privkey without first having to derive the descriptor checksum.
Alternative to #24161.