-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add silentpayments (BIP352) module #1471
Closed
theStack
wants to merge
13
commits into
bitcoin-core:master
from
theStack:silentpayments-module-demo
+3,560
−11
Closed
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a9a5fe8
build: add skeleton for new silentpayments (BIP352) module
theStack 6e3ed2d
doc: add module description for secp256k1-silentpayments
theStack 81d1303
silentpayments: add private tweak data creation routine
theStack 98f5ba4
silentpayments: add public tweak data creation routine
theStack 842e5bf
silentpayments: add tweaked pubkey creation routine (for light client…
theStack b0e3796
silentpayments: add shared secret creation routine (a*B == A*b)
theStack 2a00e12
silentpayments: add label tweak calculation routine
theStack dbcccbb
silentpayments: add routine for creating labelled spend pubkeys (for …
theStack 8460be5
silentpayments: implement output pubkey creation (for sender)
theStack d6c9856
silentpayments: add routine for tx output scanning (for receiver)
theStack 26bdb5f
silentpayments: implement output spending privkey creation (for recei…
theStack 59488c4
tests: add BIP-352 test vectors
theStack e4ffa03
ci: enable silentpayments module
theStack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
silentpayments: add private tweak data creation routine
commit 81d13038d51fbab400cc247512fbaf939db08d49
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
in "silentpayments: add private tweak data creation routine" (81d1303):
Thinking about this more, is there a usecase where the sender might need
a_sum
and not need the shared secret? If not, seems like it would be better to have the API accept private keys as an input and return the final shared secret. Otherwise, callers need to be really careful witha_sum
as it could be a single private key.What about renaming this function to something like
secp256k1_silentpayments_create_shared_secret_from_private_data
and it returnsunsigned char shared_secret33
. This way, we can pass pointers to the privkey data and get back the shared secret without needing to worry about handling a potentially dangerousa_sum
in between.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.
The only
a_sum
/input_hash
reuse scenario I could think of is one where the sender wants to create a transaction with more than one silent payments recipient (and with that, different scan pubkeys, i.e. the same recipient with different labels but same scan pubkey wouldn't count as "different" in that sense). Given that sending is an infrequent scenario and calculating a_sum and input_hash are comparably cheap operations, that's probably not a big deal though. The receiving/scanning part is potentially more of a problem, see comment below.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.
Great point. This could be a fairly common usecase (e.g. an exchange processing withdrawals to silent payment addresses), but it is still a bounded problem in that you can't send to more than silent payment addresses in a single transaction, where is the number of outputs you can fit in a single block.
I'm leaning toward making this so the caller doesn't need to handle intermediary secret data. The other option is we expose both routines in the API?
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.
Oops, I missed this comment last week. I agree that a
secp256k1_silentpayments_create_shared_secret_from_private_data
routine would be useful for the reasons you mentioned (i.e. avoid having to handle intermediate secret key data), will add one in a bit. I tend to think that exposing both routines still makes sense, in cases where performance for sending to multiple receivers is really a concern? Will keep the current one around for discussion, if it's not considered useful it can still be removed later.