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

NUT-XX: Payment Requests #124

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

NUT-XX: Payment Requests #124

wants to merge 6 commits into from

Conversation

Egge21M
Copy link
Contributor

@Egge21M Egge21M commented May 26, 2024

Cashu transactions are initiated by the sender and can be pushed to the receiver without any additional help. However for many use cases requesting a payment may be more desirable (e.g. point-of-sales). This proposal introduces a standardised format for payment requests, that supply a sending wallet with all information necessary to complete the transaction.

xx.md Outdated Show resolved Hide resolved
xx.md Outdated
```go
type PaymentRequest struct {
A int `amount (optional)`
U string `unit`

Choose a reason for hiding this comment

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

Can the unit also be optional and default to sats?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking that as well, however I can receivers run into compatibility issues quickly if they let users choose the unit.

xx.md Outdated
- unit: The unit of the requested token (e.g. sats)
- mint: The mint to use to mint the token
- description: A human readable discription that the sending wallet will display after scanning the request
- transport: The method of transport chosen to transmit the created token to the sender (can be multiple, sorted by preference)

Choose a reason for hiding this comment

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

Is there a use case where transport is empty? Or should there be a minimum of one element in the list?

@thesimplekid
Copy link
Collaborator

What do you think of an optional condition that could specify spending conditions. For example if the receiver wants it locked using P2PK?

@Egge21M
Copy link
Contributor Author

Egge21M commented May 26, 2024

What do you think of an optional condition that could specify spending conditions. For example if the receiver wants it locked using P2PK?

Yes, this should be included. I will add it later doday

@Egge21M Egge21M marked this pull request as ready for review May 27, 2024 05:00
@callebtc
Copy link
Contributor

callebtc commented May 27, 2024

What do you think of an optional condition that could specify spending conditions. For example if the receiver wants it locked using P2PK?

Very cool. The receiver could specify the secret as well.

Edit: maybe even better: Y – the sender doesn't need to know the secret.

Edit 2: Problem: it would require one Y per proof you expect, which is not likely to be known upfront in most cases.

@Egge21M
Copy link
Contributor Author

Egge21M commented May 27, 2024

Very cool. The receiver could specify the secret as well.

I added l for specifying a locking script. However specifying secret / Y is overkill I believe. It's nice to have, but introduces a lot of complexity and will bloat the request size quite a bit too.

xx.md Outdated Show resolved Hide resolved
xx.md Show resolved Hide resolved
"r": str <optional>,
"d": str <optional>,
"m": str <optional>,
"l": str <optional>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the format of the lock script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking to just make it the well known secret format. Basically what will become Proof.secret.

However thinking about it, that will not work because of the nonce. Do you have something in mind? Otherwise we just have to come up with another Type

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe just the well known secret without a nonce and the sender can add the nonce?

xx.md Outdated
_Example_

```sh
cashrqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a cashureq prefix?

can we add a version byte like with keysets? It would be good to add a paragraph explaining the payment request serialization like with tokenv3:

cashureq[version][request object]

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it'd be better to use a prefix that doesn't look so visually similar to a token: creq?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good point. The first byte after the prefix is indeed a version byte. I'll update the text to be more clear about that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a slightly different notation that makes it clear what exactly is concatianated and encoded when. Let me know what you think

xx.md Outdated Show resolved Hide resolved
xx.md Outdated Show resolved Hide resolved
@callebtc callebtc changed the title Payment Requests NUT-XX: Payment Requests Aug 29, 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.

None yet

4 participants