-
Notifications
You must be signed in to change notification settings - Fork 5.9k
BIP 352: Silent Payments #1458
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
BIP 352: Silent Payments #1458
Conversation
0ef28f3 to
f1c188f
Compare
brandonblack
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.
Glad to see this proposal advancing! I think with some minor changes it can be compatible with MuSig2 Taproot Keypaths (and potentially other off chain key aggregation schemes), which make it a powerful way of transacting privately even between users with advanced keys and scripts on Taproot.
vostrnad
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.
Some light review so far, but I'm really liking the proposal. Being able to easily implement just the sending part will no doubt greatly accelerate adoption by wallets.
Apart from the inline comments I also have a few style nits:
- "e.g" is used instead of "e.g." in a few places.
- Mixed usage of curly (
’) and straight (') single quotes. - Some footnotes ("Rationale and References") are missing a period at the end.
- In Creating outputs, "Let a = a0 + a1 + … ai, where each ai" should have an be the last member of the sum, like in the rest of the document. Same goes for the sum in Scanning where the last member should be An.
f1c188f to
1ae1b4b
Compare
98f37a9 to
d9e5a1b
Compare
vostrnad
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.
Second round of review. To complement this I wrote a quick and dirty implementation covering most of both sending and receiving. It was quite easy and seems to work, can't wait for test vectors to see how many bugs it has! 😅
In addition to the inline comments I have one general comment and one style nit:
- There are no specifics on how to deal with situations where EC operations fail to produce a valid point. I'm not sure if this is necessary, just mentioning this because my implementation has a lot of assertions.
- Tweak expressions are not consistent in whether the G part comes first or second. For example, in BIP341 it always comes second.
889a0b6 to
be18f6f
Compare
|
Thanks for the continued review, @vostrnad !
Do you have a specific scenario in mind? I'm certainly not an expert in this area, but I don't think we should get a failure by doing additions and multiplications (summing priv keys, pub keys, ecdh). If we can have a failure when summing up the private keys, public keys, or during the ECDH step, our only recourse would be to restart the coin selection process and ensure we get different inputs. |
ad7fa34 to
d342de6
Compare
One reason EC operations can fail is when a pseudorandom scalar value exceeds the curve order, which should only happen with negligible probability but other BIPs still have special cases for when it happens (e.g. BIP32, BIP340 and BIP341). I suppose it could be fine to ignore this, but I'm certainly no expert either. |
87f3104 to
d920133
Compare
I'll take a look to see how it's being handled in those BIPs. Ideally, we can reuse the same solution here. The main thing is ensuring both the sender and receiver can deterministically handle these low-probability events. |
|
@luke-jr Unless you see anything objectionable, please assign BIP number. |
I did some more reading on this and from what I can tell this applies to choosing a scalar which results in a valid point on the curve, which is not true for every scalar. In our case, we are already using existing valid private keys or, in the case of the silent payment address, are using BIP32 to generate them. Adding these keys together (using the elliptic curve group operation) or multiplying a valid scalar with a point (ECDH) gives us a result that is guaranteed to be a valid point on the curve. |
Co-Authored-By: Ruben Somsen <rsomsen@gmail.com>
* reference.py contains the silent payment specific code * secp256k1.py for doing the EC operations * bech32m.py contains code for encoding/decoding bech32(m) addresses * bitcoin_utils.py contains some helper code, not specific to silent payments * send_and_receive_test_vectors.json contains the wallet unit test vectors Co-Authored-By: S3RK <1466284+S3RK@users.noreply.github.com> Co-Authored-By: Oghenovo Usiwoma <37949128+Eunovo@users.noreply.github.com> Co-authored-by: S.Blagogee <34041358+setavenger@users.noreply.github.com>
Punctuation and wording improvements. Co-authored-by: Mark "Murch" Erhardt <murch@murch.one>
32a3293 to
82c2f78
Compare
Updated to Proposed. Thanks for the review @murchandamus , RFM! |
82c2f78 to
a60bfc3
Compare
- Fix link - Add explanation for scalar multiplication - Spelling error in test section
a60bfc3 to
17e1d16
Compare
|
@josibake When thinking about potential APIs for BitcoinJS with SP, the concept of PSBTs doesn't seem to work well with SP at all. It almost precludes the tx creation, signing, and finalizing MUST be done on the same device in one go. I think the SP BIP should at least mention that PSBT use should be avoided in the case of fully unsigned PSBTs or only has signatures that are SIGHASH_ANYONECANPAY. Since someone could easily modify the input set. In the long run, SP will require a few upgrades to PSBT one of which is backwards incompatible.
There are a lot of use cases for PSBT which would be dangerous to use with SP and some loose non-required "conventions." I would be interested to hear your thoughts. I don't have a clear change proposal so I couldn't think of a PR to make, so excuse my reviving a dead PR. |
|
Hey @junderw , we are discussing PSBT proposals on delving bitcoin and @andrewtoth has already started a draft BIP. It would be great to have your input over there! Regarding updates to this BIP, I think it would be more appropriate to finalize a silent payments PSBT BIP and then link to that BIP here. If we do end up needing a PSBTv3 for supporting silent payments, then we should definitely mention incompatibility with older PSBT versions here and point to the new PSBTv3 proposal. |
|
@josibake @RubenSomsen Any plans to update this BIP per the discussion in libsecp? For instance, bitcoin-core/secp256k1#1765 (comment). |
Looks like #2055 is one step. |
furszy
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.
@josibake @RubenSomsen Any plans to update this BIP per the discussion in libsecp? For instance, bitcoin-core/secp256k1#1765 (comment).
Looks like #2055 is one step.
@jonatack #2055 is not related to #1458 (comment). The first one you mentioned requires an API workflow modification while the second one (#2055) is just a minimal data type change. The API change is still being benchmarked and discussed and is not ready yet.
|
@furszy thanks for the clarification! |
* this allows the indexer to skip blocks, that do not support silent payments, resulting in faster indexing and less redundant work. * https://www.bitaps.com/842579 * bitcoin/bips#1458
* this allows the indexer to skip blocks, that do not support silent payments, resulting in faster indexing and less redundant work. * https://www.bitaps.com/842579 * bitcoin/bips#1458
* this allows the indexer to skip blocks, that do not support silent payments, resulting in faster indexing and less redundant work. * https://www.bitaps.com/842579 * bitcoin/bips#1458
* this allows the indexer to skip blocks that do not support silent payments * https://www.bitaps.com/842579 * bitcoin/bips#1458
Silent payments is a static address protocol for Bitcoin, originally proposed on the mailing list here: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-March/020180.html
Since then, the proposal has received several rounds of review and has a WIP implementation here: bitcoin/bitcoin#27827 . The proposal has also been sent to the mailing list for review here: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-June/021750.html
Proposing this as an informational BIP to ensure wallets across the ecosystem can standardize and correctly implement the protocol.