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 payments v1 #1848

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

Conversation

motorina0
Copy link
Member

Silent Payments

Receive private payments from anyone on a single static address without requiring any interaction or extra on-chain overhead.

More on Silent Payments:

silent-payments.spec contains a simple test for Silent Payments.

The purpose of this PR is:

  • to see if this library can support such a construct and how it would look like (after p2tr-v1 branch gets merged)
  • serve as a starting point for developers that want to add silent payments to their wallet
  • start a discussion on how Silent Payments should be constructed and check that this implementation is correct

This PR is not concerned on the scanning/detecting silent payments.

address: string,
value: number,
): Promise<void> {
await regtestUtils.broadcast(tx.toBuffer().toString('hex'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we have toHex()

senderKeyPair.privateKey!,
);

const receiverSharedSecred = ecc.pointMultiply(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: receiverSharedSecret (t at the end)

});

// destination
const { address } = bitcoin.payments.p2tr({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little more explanation would be nice here.

sharedSecret: Buffer,
): { psbt: bitcoin.Psbt; address: string } {
const psbt = new bitcoin.Psbt({ network: regtest });
psbt.addInput({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little more explanation would be nice here.


const ECPair = ECPairFactory(ecc);

// This logic will be extracted to ecpair
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old comment?

Copy link
Member

@junderw junderw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a little more explanation for people who haven't read the gist and just happen to read this file.

Maybe make some diagrams or something in a large block comment.

As long as someone can read it and understand what a silent payment is, why its useful, and in which parts of the code are we doing something special to allow it to happen.

(also pointing out how taproot support helps us to perform this would be helpful for those learning)

@bitcoinjs bitcoinjs deleted a comment Apr 9, 2023
@bitcoinjs bitcoinjs deleted a comment from vatkachenko Nov 8, 2024
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.

3 participants