Skip to content
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

Silent payment basic scheme #109

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

louisinger
Copy link
Collaborator

Implementation of silent payments "BIP352" based on the python reference code.

TL;DR

  • new silentpayment module exported in index.ts
  • SilentPaymentAddress lets you decode & encode silent payment addresses (2 keys version)
  • SilentPayment class needs an injected secp256k1 lib and exposes a set of useful function used to send & receive to silent payment.
  • unit tests copy pasted from https://github.com/Overtorment/SilentPayments
  • add regtest integration test checking send & receive

@tiero @altafan please review

@socket-security
Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
tiny-secp256k1 2.2.1...2.2.3 None +0/-0 223 kB junderw

src/silentpayment.d.ts Outdated Show resolved Hide resolved
@altafan
Copy link
Collaborator

altafan commented Sep 20, 2023

after an offline conversation, @louisinger and I agreed on:

  • changing the signature of the SilentPayment.pay method that is now too complex: ATM it's used to create a list of SP outputs to be added to a pset, while its very job is to create the silent script for an output. We are going to simplify this method by renaming it makeSilentScript. Just like any other kind of pset output, it's up to the user to craft it the right way.
  • moving sumPublicKeys and sumSecretKeys to bip341 package, as they are just utils methods with a more general context (aggregation of schnorr keys).

This could be enough for a first iteration of silent payments, although my vision is to make this class look like any other kind of Payment, integrated with ad hoc types and functions in the address package to easily generate silent addresses, as this is essentially the way we designed (inherited from bitcoinjs) support for all the output script types.

ts_src/silentpayment.ts Outdated Show resolved Hide resolved
ts_src/silentpayment.ts Outdated Show resolved Hide resolved
ts_src/silentpayment.ts Outdated Show resolved Hide resolved
ts_src/silentpayment.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants