-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Silent Payments: Receiving #32966
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
base: master
Are you sure you want to change the base?
Silent Payments: Receiving #32966
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32966. ReviewsSee the guideline for information on the review process. 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. |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
Another thing I noticed while testing using the
It seems safer, for backups, to send change to the same silent payment address. Wallet created by: bitcoin rpc createwallet Silent blank=true silent_payments=true
bitcoin rpc importdescriptors '[{"desc": "sp(xprv...,xprv...)", "timestamp": "now", "active": true]Also looking forward to have labels back :-) |
josibake
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.
Did a big overview with @Sjors , leaving the notes from our discussion as a review. In general, I think we should investigate using a custom type for the scan key since a lot of the changes seem to be hacking around the fact we represent the scan key as a private key, but then often need to use it as not a private key.
Still in the process of reviewing, but leaving the initial notes for now
src/script/descriptor.cpp
Outdated
| @@ -206,6 +206,8 @@ struct PubkeyProvider | |||
| /** Get the descriptor string form including private data (if available in arg). */ | |||
| virtual bool ToPrivateString(const SigningProvider& arg, std::string& out) const = 0; | |||
|
|
|||
| virtual std::optional<std::string> ToPrivateString(const CKey& key) const = 0; | |||
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.
While reviewing the PR, it seems a lot of things could be simplified by if we just treated the scan key as something that isn't a CKey, i.e., we introduce a completely new object for holding the scan key. I think that would allow us to drop this commit and simplify other places where we are trying to work around the fact that a scan key isnt really a private key.
I haven't thought this all the way through yet, but in my initial pass on the PR it seems like it should be possible.
The scan key will be derived while the descriptor is parsed, so we must pass the master xpriv into `GenerateWalletDescriptor`. The spend key is expanded later so it is specified as an xpub and path instead.
In future commits, a Silent Payment enabled wallet will write found SIlentPaymentOutputs to the DB. Although the XOnlyPubKey can be derived from adding the Spend pubkey and the tweak, we opt to save the the found XOnlyPubKey because that removes the need for a CPubkey::TweakAdd() in the codebase
Co-authored-by: Ava Chow <[email protected]>
Co-authored-by: Ava Chow <[email protected]>
Co-authored-by: Ava Chow <[email protected]>
silent_payments wallet needs to scan entire blocks since it doesn't know ahead of time which scriptPubKeys to use in it's fast rescan filter.
55485a6 to
fcc8b88
Compare
Co-authored-by: Ava Chow <[email protected]>
traditionally, the receiving scripts are known to the core wallet because they are added to the addressbook at the time they are requested. in silent payments, the outputs are not known until found. its important, however, to have the found scripts in the addressbook so all of the change accounting can be down properly. this commits adds found outputs to the address book if they are not change. the way change is determined is a bit hacky in that we just check if the found output was found with a label (since this is the only label currently implemented). in the future, we should specifically check for a change specific label.
The wallet tries to match change OutputTpe to other outputs to preserve privacy. Use silent payment change address when sending coins to: - any silent payment address - any taproot address
`CreateTransaction` fails if change_type is set to OutputType::SILENT_PAYMENTS and there are no eligible inputs for the transaction. This commit modifies `CreateTransaction` logic to make a second attempt to create a tx without OutputType::SILENT_PAYMENTS change_type
This allows wallets with only sp descs to use sp change destination for transactions.
Co-authored-by: macgyver13 <[email protected]>
fcc8b88 to
3bfab00
Compare
|
🐙 This pull request conflicts with the target branch and needs rebase. |
This PR is part of integrating silent payments into Bitcoin Core. Status and tracking for the project is managed in #28536
This PR is based on #28201 and will remain in draft until #28201 is merged.
This PR:
SilentPaymentsDescriptorScriptPubKeyManImpl that is a subclass ofDescriptorScriptPubKeyMansilent-paymentsdestination for change when sending tosilent-paymentsdestinationFollow-ups