From b7b07816105b5b288b59cb8fb9d469bddcfc6cd3 Mon Sep 17 00:00:00 2001 From: Egge Date: Sun, 26 May 2024 07:25:48 +0200 Subject: [PATCH 01/24] added v1 draft --- xx.md | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 xx.md diff --git a/xx.md b/xx.md new file mode 100644 index 00000000..918c075c --- /dev/null +++ b/xx.md @@ -0,0 +1,96 @@ +# NUT-XX: Payment Requests + +`optional` + +--- + +This NUT introduces a standardised format for payment requests, that supply a sending wallet with all information necessary to complete the transaction. This enables many use-cases where a transaction is better initiated by the receiver (e.g. point of sale). + +## Flow + +1. Receiver creates a payment request, encodes it and displays it to the sender +2. Sender scans the request and constructs a matching token +3. Sender sends the token according to the transport specified in the payment request +4. Receiver receives the token and finalises the transaction + +## Payment Request + +A Payment Request is defined as follows + +```go +type PaymentRequest struct { + A int `amount (optional)` + U string `unit` + R string `mint url (optional)` + D string `description (optional)` + M string `memo (optional)` + T []Transport `transport` +} +``` + +while Transport is defined as + +```go +type Transport struct { + T string `type` + Ta string `target` +} +``` + +- amount: The amount of the requested token (payment amount) +- 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) + +## Encoded Request + +Cashu Payment Requests can be encoded and displayed/sent as string or qr code. They underlying object is serialised using CBOR and finlly base64 encoded and prefixed with a version byte and standard prefix. + +_Example_ + +```sh +cashrqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag +``` + +## Reference Implementation + +```go +package main + +import ( + "encoding/base64" + "fmt" + "log" + + "github.com/fxamacker/cbor/v2" +) + +func main() { + type Transport struct { + T string + Ta string + } + type PaymentRequest struct { + A int + U string + M string + D string + T []Transport + } + + t := Transport{T: "nostr", Ta: "nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0suxa0kj"} + pr := PaymentRequest{A: 21, U: "sat", M: "https://mint.minibits.cash/Bitcoin", D: "Plesase pay the very first cashu pr", T: []Transport{t}} + b, err := cbor.Marshal(pr) + if err != nil { + log.Fatal("CBOR encoding failed...") + } + pre := "cashrq" + version := byte(0x01) + b = append([]byte{version}, b...) + encodedString := base64.RawURLEncoding.EncodeToString(b) + res := pre + encodedString + fmt.Printf("%s", res) +} + +``` From b12b4ee04f03a724a742dcb5e566dea024fcfe2d Mon Sep 17 00:00:00 2001 From: Egge Date: Sun, 26 May 2024 07:44:05 +0200 Subject: [PATCH 02/24] updated reference implementation --- xx.md | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/xx.md b/xx.md index 918c075c..d24b51e7 100644 --- a/xx.md +++ b/xx.md @@ -66,31 +66,38 @@ import ( "github.com/fxamacker/cbor/v2" ) -func main() { - type Transport struct { - T string - Ta string - } - type PaymentRequest struct { - A int - U string - M string - D string - T []Transport - } +const ( + pre = "cashrq" + version = byte(0x01) +) - t := Transport{T: "nostr", Ta: "nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0suxa0kj"} - pr := PaymentRequest{A: 21, U: "sat", M: "https://mint.minibits.cash/Bitcoin", D: "Plesase pay the very first cashu pr", T: []Transport{t}} +type Transport struct { + T string + Ta string +} +type PaymentRequest struct { + A int + U string + M string + D string + T []Transport +} + +func encodeRequest(pr PaymentRequest) string { b, err := cbor.Marshal(pr) if err != nil { log.Fatal("CBOR encoding failed...") } - pre := "cashrq" - version := byte(0x01) b = append([]byte{version}, b...) encodedString := base64.RawURLEncoding.EncodeToString(b) res := pre + encodedString - fmt.Printf("%s", res) + return res } +func main() { + t := Transport{T: "nostr", Ta: "nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0suxa0kj"} + pr := PaymentRequest{A: 21, U: "sat", M: "https://mint.minibits.cash/Bitcoin", D: "Plesase pay the very first cashu pr", T: []Transport{t}} + res := encodeRequest(pr) + fmt.Printf("%s", res) +} ``` From 9021c0979772c86430bbc9e07cb0c57ebbbc2654 Mon Sep 17 00:00:00 2001 From: Egge Date: Sun, 26 May 2024 22:40:10 +0200 Subject: [PATCH 03/24] updated referece Impl. + began formatting --- xx.md | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/xx.md b/xx.md index d24b51e7..565f5e53 100644 --- a/xx.md +++ b/xx.md @@ -17,14 +17,14 @@ This NUT introduces a standardised format for payment requests, that supply a se A Payment Request is defined as follows -```go -type PaymentRequest struct { - A int `amount (optional)` - U string `unit` - R string `mint url (optional)` - D string `description (optional)` - M string `memo (optional)` - T []Transport `transport` +```json +{ + "a": int , + "u": str, + "r": str , + "d": str , + "m": str , + "t": Transport } ``` @@ -37,11 +37,11 @@ type Transport struct { } ``` -- amount: The amount of the requested token (payment amount) -- 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) +- a: The amount of the requested token (payment amount) +- u: The unit of the requested token (e.g. sats) +- r: The mint to use to mint the token +- d: A human readable description that the sending wallet will display after scanning the request +- t: The method of transport chosen to transmit the created token to the sender (can be multiple, sorted by preference) ## Encoded Request @@ -62,6 +62,7 @@ import ( "encoding/base64" "fmt" "log" + "strings" "github.com/fxamacker/cbor/v2" ) @@ -94,10 +95,28 @@ func encodeRequest(pr PaymentRequest) string { return res } +func decodeRequest(prString string) PaymentRequest { + s := strings.TrimPrefix(prString, pre) + decoded, err := base64.RawURLEncoding.DecodeString(s) + data := decoded[1:] + if err != nil { + log.Fatal("String decoding failed") + } + var v PaymentRequest + err = cbor.Unmarshal(data, &v) + if err != nil { + fmt.Println(err) + log.Fatal("CBOR decoding failed") + } + return v +} + func main() { t := Transport{T: "nostr", Ta: "nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0suxa0kj"} pr := PaymentRequest{A: 21, U: "sat", M: "https://mint.minibits.cash/Bitcoin", D: "Plesase pay the very first cashu pr", T: []Transport{t}} res := encodeRequest(pr) - fmt.Printf("%s", res) + fmt.Println(res) + d := decodeRequest(res) + fmt.Printf("%+v\n", d) } ``` From 0e9b53d1522f7ff2f4808dad4eff7a1310134d30 Mon Sep 17 00:00:00 2001 From: Egge Date: Mon, 27 May 2024 06:51:32 +0200 Subject: [PATCH 04/24] formatting --- xx.md | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/xx.md b/xx.md index 565f5e53..4b2fa268 100644 --- a/xx.md +++ b/xx.md @@ -24,28 +24,55 @@ A Payment Request is defined as follows "r": str , "d": str , "m": str , + l: str , "t": Transport } ``` while Transport is defined as -```go -type Transport struct { - T string `type` - Ta string `target` -} -``` - - a: The amount of the requested token (payment amount) - u: The unit of the requested token (e.g. sats) - r: The mint to use to mint the token - d: A human readable description that the sending wallet will display after scanning the request +- m: The memo of the requested token (can be used for accounting purposes) +- l: The lock script of the requested token - t: The method of transport chosen to transmit the created token to the sender (can be multiple, sorted by preference) +The sending wallet MUST honor all parts of a payment request that are specified + +## Transport + +Transport is an important part of Cashu Payment Requests. Receivers can choose what kind of transport they want to support and where they want to receive the token. By making this clear in the payment requests, wallets can handle payment requests accordingly (or decline them if they do not support the transport layer). A transport consists of a type and a target. + +```json +{ + "t": str, + "ta": Target +} +``` + +- t: type of Transport +- ta: target of Transport + +There can be many transport layers, but here are some recommendations: + +- nostr + - type: "nostr" + - target: `{nprofile: "nprofile..."}` +- post + - type: "post" + - target: `{url: ""}` +- email + - type: "email" + - target: `{email: ""}` +- sms + - type: "sms" + - target: `{num: "phone number"}` + ## Encoded Request -Cashu Payment Requests can be encoded and displayed/sent as string or qr code. They underlying object is serialised using CBOR and finlly base64 encoded and prefixed with a version byte and standard prefix. +Cashu Payment Requests can be encoded and displayed/sent as string or qr code. They underlying object is serialised using CBOR and finally base64 encoded and prefixed with a version byte and standard prefix. _Example_ From 80e6d6f786d774efb738384b20cfd2d65197d408 Mon Sep 17 00:00:00 2001 From: Egge Date: Mon, 27 May 2024 07:02:28 +0200 Subject: [PATCH 05/24] fixed typo & removed ref impl --- xx.md | 72 ++--------------------------------------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/xx.md b/xx.md index 4b2fa268..d6c0db7c 100644 --- a/xx.md +++ b/xx.md @@ -24,7 +24,7 @@ A Payment Request is defined as follows "r": str , "d": str , "m": str , - l: str , + "l": str , "t": Transport } ``` @@ -53,7 +53,7 @@ Transport is an important part of Cashu Payment Requests. Receivers can choose w ``` - t: type of Transport -- ta: target of Transport + - ta: target of Transport There can be many transport layers, but here are some recommendations: @@ -79,71 +79,3 @@ _Example_ ```sh cashrqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag ``` - -## Reference Implementation - -```go -package main - -import ( - "encoding/base64" - "fmt" - "log" - "strings" - - "github.com/fxamacker/cbor/v2" -) - -const ( - pre = "cashrq" - version = byte(0x01) -) - -type Transport struct { - T string - Ta string -} -type PaymentRequest struct { - A int - U string - M string - D string - T []Transport -} - -func encodeRequest(pr PaymentRequest) string { - b, err := cbor.Marshal(pr) - if err != nil { - log.Fatal("CBOR encoding failed...") - } - b = append([]byte{version}, b...) - encodedString := base64.RawURLEncoding.EncodeToString(b) - res := pre + encodedString - return res -} - -func decodeRequest(prString string) PaymentRequest { - s := strings.TrimPrefix(prString, pre) - decoded, err := base64.RawURLEncoding.DecodeString(s) - data := decoded[1:] - if err != nil { - log.Fatal("String decoding failed") - } - var v PaymentRequest - err = cbor.Unmarshal(data, &v) - if err != nil { - fmt.Println(err) - log.Fatal("CBOR decoding failed") - } - return v -} - -func main() { - t := Transport{T: "nostr", Ta: "nprofile1qqsdmup6e2z6mcpeue6z6kl08he49hcen5xnrc3tnpvw0mdgtjemh0suxa0kj"} - pr := PaymentRequest{A: 21, U: "sat", M: "https://mint.minibits.cash/Bitcoin", D: "Plesase pay the very first cashu pr", T: []Transport{t}} - res := encodeRequest(pr) - fmt.Println(res) - d := decodeRequest(res) - fmt.Printf("%+v\n", d) -} -``` From 50fc922f417aca9c233c46d06e1eb877a50d36a3 Mon Sep 17 00:00:00 2001 From: Egge Date: Fri, 31 May 2024 16:18:38 +0200 Subject: [PATCH 06/24] changed transport + token --- xx.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xx.md b/xx.md index d6c0db7c..77675840 100644 --- a/xx.md +++ b/xx.md @@ -48,34 +48,42 @@ Transport is an important part of Cashu Payment Requests. Receivers can choose w ```json { "t": str, - "ta": Target + "a": Target } ``` - t: type of Transport - - ta: target of Transport +- a: target of Transport There can be many transport layers, but here are some recommendations: - nostr - type: "nostr" - - target: `{nprofile: "nprofile..."}` + - target: "" - post - type: "post" - - target: `{url: ""}` + - target: "" - email - type: "email" - - target: `{email: ""}` + - target: "" - sms - type: "sms" - - target: `{num: "phone number"}` + - target: "" + +Regardless of the transport layer the payload should always (unless specified differently) be a JSON serialised object as follows: + +```json +{ "token": "cashuAy..." } +``` ## Encoded Request Cashu Payment Requests can be encoded and displayed/sent as string or qr code. They underlying object is serialised using CBOR and finally base64 encoded and prefixed with a version byte and standard prefix. +`"creq" + base64(versionByte + cbor(PaymentRequest))` + _Example_ ```sh -cashrqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag +creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag ``` From 1632d882f8e3a8de05a3303734ff97124a78a18f Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:31:03 +0200 Subject: [PATCH 07/24] suggestions --- xx.md | 58 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/xx.md b/xx.md index 77675840..1602a3b7 100644 --- a/xx.md +++ b/xx.md @@ -19,11 +19,11 @@ A Payment Request is defined as follows ```json { + "i": str , "a": int , - "u": str, - "r": str , + "u": str , + "r": Array[str] , "d": str , - "m": str , "l": str , "t": Transport } @@ -31,59 +31,61 @@ A Payment Request is defined as follows while Transport is defined as -- a: The amount of the requested token (payment amount) -- u: The unit of the requested token (e.g. sats) -- r: The mint to use to mint the token +- i: Payment id to be included in the payment payload +- a: The amount of the requested payment +- u: The unit of the requested payment (MUST be set if `a` is set) +- r: A set of mints from which the payment is requested - d: A human readable description that the sending wallet will display after scanning the request -- m: The memo of the requested token (can be used for accounting purposes) -- l: The lock script of the requested token -- t: The method of transport chosen to transmit the created token to the sender (can be multiple, sorted by preference) - -The sending wallet MUST honor all parts of a payment request that are specified +- t: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) ## Transport -Transport is an important part of Cashu Payment Requests. Receivers can choose what kind of transport they want to support and where they want to receive the token. By making this clear in the payment requests, wallets can handle payment requests accordingly (or decline them if they do not support the transport layer). A transport consists of a type and a target. +Transport specifies methods for sending the ecash to the receiver. A transport consists of a type and a target. ```json { "t": str, - "a": Target + "a": str, + "g": Array[Array[str, str]] } ``` - t: type of Transport - a: target of Transport +- g: optional tags for the Transport -There can be many transport layers, but here are some recommendations: +There are different transport layers: - nostr - - type: "nostr" - - target: "" + - type: `nostr` + - target: `` + - tags: `[["1", "NIP-04"], ["2", "NIP-17"], ["3", "NIP-61"]]` - post - - type: "post" - - target: "" -- email - - type: "email" - - target: "" -- sms - - type: "sms" - - target: "" + - type: `post` + - target: `` -Regardless of the transport layer the payload should always (unless specified differently) be a JSON serialised object as follows: +Regardless of the transport layer, the payload sent to the receiver is a JSON serialized object as follows: ```json -{ "token": "cashuAy..." } +{ + "id": str , + "memo": str , + "token": TokenV4_JSON +} ``` +Here, `id` is the payment id (corresponding to `i` in request), `memo` is an optional memo to be sent to the receiver with the payment, and `token` is a TokenV4 JSON object as specified in [NUT-00][00]. + ## Encoded Request -Cashu Payment Requests can be encoded and displayed/sent as string or qr code. They underlying object is serialised using CBOR and finally base64 encoded and prefixed with a version byte and standard prefix. +The payment request is serialized using CBOR, encoded in `base64_urlsafe`, together with a prefix `creq` and a version `A`: -`"creq" + base64(versionByte + cbor(PaymentRequest))` +`"creq" + "A" + base64(CBOR(PaymentRequest))` _Example_ ```sh creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag ``` + +[00]: 00.md \ No newline at end of file From 0c57a0dfbb1fa4782c3df69b5e6cedea1b534a10 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:36:12 +0200 Subject: [PATCH 08/24] fix --- xx.md | 1 - 1 file changed, 1 deletion(-) diff --git a/xx.md b/xx.md index 1602a3b7..6274ed2f 100644 --- a/xx.md +++ b/xx.md @@ -24,7 +24,6 @@ A Payment Request is defined as follows "u": str , "r": Array[str] , "d": str , - "l": str , "t": Transport } ``` From 3349e241699405f30035aacea20815eb768e6c82 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 15 Oct 2024 19:29:08 +0200 Subject: [PATCH 09/24] remove TokenV4 JSON, instead use mint unit proofs --- xx.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/xx.md b/xx.md index 6274ed2f..e3ee60ee 100644 --- a/xx.md +++ b/xx.md @@ -22,7 +22,8 @@ A Payment Request is defined as follows "i": str , "a": int , "u": str , - "r": Array[str] , + "r": bool , + "m": Array[str] , "d": str , "t": Transport } @@ -30,12 +31,13 @@ A Payment Request is defined as follows while Transport is defined as -- i: Payment id to be included in the payment payload -- a: The amount of the requested payment -- u: The unit of the requested payment (MUST be set if `a` is set) -- r: A set of mints from which the payment is requested -- d: A human readable description that the sending wallet will display after scanning the request -- t: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) +- `i`: Payment id to be included in the payment payload +- `a`: The amount of the requested payment +- `u`: The unit of the requested payment (MUST be set if `a` is set) +- `s`: Whether the payment request is for single use +- `m`: A set of mints from which the payment is requested +- `d`: A human readable description that the sending wallet will display after scanning the request +- `t`: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) ## Transport @@ -63,17 +65,21 @@ There are different transport layers: - type: `post` - target: `` +## Payment payload + Regardless of the transport layer, the payload sent to the receiver is a JSON serialized object as follows: ```json { "id": str , "memo": str , - "token": TokenV4_JSON + "mint": str, + "unit": , + "proofs": Array } ``` -Here, `id` is the payment id (corresponding to `i` in request), `memo` is an optional memo to be sent to the receiver with the payment, and `token` is a TokenV4 JSON object as specified in [NUT-00][00]. +Here, `id` is the payment id (corresponding to `i` in request), `memo` is an optional memo to be sent to the receiver with the payment, `mint` is the mint URL from which the ecash is from, `unit` is the unit of the payment, and `proofs` is an array of proofs (see [NUT-00][00], can also include DLEQ proofs). ## Encoded Request From ec0cb4ee9235436fa36276787ff2258c881886be Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 16 Oct 2024 20:10:04 +0200 Subject: [PATCH 10/24] add to readme --- xx.md => 18.md | 29 ++++++++++++++++++++--------- README.md | 4 +++- 2 files changed, 23 insertions(+), 10 deletions(-) rename xx.md => 18.md (73%) diff --git a/xx.md b/18.md similarity index 73% rename from xx.md rename to 18.md index e3ee60ee..ab476d15 100644 --- a/xx.md +++ b/18.md @@ -55,19 +55,30 @@ Transport specifies methods for sending the ecash to the receiver. A transport c - a: target of Transport - g: optional tags for the Transport -There are different transport layers: +### Transport types -- nostr - - type: `nostr` - - target: `` - - tags: `[["1", "NIP-04"], ["2", "NIP-17"], ["3", "NIP-61"]]` -- post - - type: `post` - - target: `` +The supported transport types are: + +#### Nostr + +- type: `nostr` +- target: `` +- tags: `[["NIP-04", "true"], ["NIP-17", "true"]]` + +The payment request MUST specify which type of Nostr message they support in the `tags`. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. + +Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. + +#### HTTP POST + +- type: `post` +- target: `` + +The execute the payment, the sender makes a `POST` request to the specified endpoint URL with the `PaymentRequestPayload` as the body. ## Payment payload -Regardless of the transport layer, the payload sent to the receiver is a JSON serialized object as follows: +If not specified otherwise, the payload sent to the receiver is a `PaymentRequestPayload` JSON serialized object as follows: ```json { diff --git a/README.md b/README.md index dcf98981..8bbb4fe3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio | [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py] | | [16][16] | Animated QR codes | [Cashu.me][cashume] | - | | [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | +| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - #### Wallets: @@ -45,7 +46,7 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio - [Nutstash][ns] - [Cashu.me][cashume] - [Gonuts][gonuts] -- [Boardwalk Cash][bwc] +- [Boardwalk][bwc] #### Mints: @@ -87,3 +88,4 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio [15]: 15.md [16]: 16.md [17]: 17.md +[18]: 18.md From 64dc4637fffc794837c9d744cc93b97364487f9d Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Thu, 17 Oct 2024 00:27:11 +0200 Subject: [PATCH 11/24] fix transport and change tag --- 18.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/18.md b/18.md index ab476d15..5cb7effc 100644 --- a/18.md +++ b/18.md @@ -25,7 +25,7 @@ A Payment Request is defined as follows "r": bool , "m": Array[str] , "d": str , - "t": Transport + "t": Array[Transport] } ``` @@ -63,9 +63,9 @@ The supported transport types are: - type: `nostr` - target: `` -- tags: `[["NIP-04", "true"], ["NIP-17", "true"]]` +- tags: `[["m", "NIP-04"],["m", "NIP-17"]]` -The payment request MUST specify which type of Nostr message they support in the `tags`. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `m` tag MUST specify at least one type of Nostr direct message type the receiver supports. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. From 573494337738eae7ea8d510fc0366666ab2dcbd0 Mon Sep 17 00:00:00 2001 From: gudnuf Date: Thu, 17 Oct 2024 11:46:28 -0700 Subject: [PATCH 12/24] change tags to support multiple values --- 18.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/18.md b/18.md index 5cb7effc..a6d7491e 100644 --- a/18.md +++ b/18.md @@ -53,19 +53,23 @@ Transport specifies methods for sending the ecash to the receiver. A transport c - t: type of Transport - a: target of Transport -- g: optional tags for the Transport +- g: optional tags for the Transport ### Transport types The supported transport types are: +### Tags + +Tags are an optional array of `[tag, value, value, ...]` tuples that can be used to specify additional features about the transport. A single tag can have multiple values. + #### Nostr - type: `nostr` - target: `` -- tags: `[["m", "NIP-04"],["m", "NIP-17"]]` +- tags: `[["n","04", "17"]]` -The `m` tag MUST specify at least one type of Nostr direct message type the receiver supports. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `n` tag specifies the NIPs the receiver supports. At lease one type of Nostr direct message MUST be specified. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. @@ -104,4 +108,4 @@ _Example_ creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag ``` -[00]: 00.md \ No newline at end of file +[00]: 00.md From 40ec76bb2124adbbc92a73940097c94ed237bbcb Mon Sep 17 00:00:00 2001 From: gudnuf Date: Thu, 17 Oct 2024 12:45:00 -0700 Subject: [PATCH 13/24] remove NIP-04 --- 18.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/18.md b/18.md index a6d7491e..d16cdece 100644 --- a/18.md +++ b/18.md @@ -67,11 +67,11 @@ Tags are an optional array of `[tag, value, value, ...]` tuples that can be used - type: `nostr` - target: `` -- tags: `[["n","04", "17"]]` +- tags: `[["n", "17"]]` -The `n` tag specifies the NIPs the receiver supports. At lease one type of Nostr direct message MUST be specified. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `n` tag specifies the NIPs the receiver supports. At least one tag value MUST be specified. For [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. -Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. +[NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) SHOULDNT be used because it is deprecated and reveals metadata about sender and receiver public keys. #### HTTP POST From 28e6f9f89a20b2b4f53d870f63870a38e741742b Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 15 Oct 2024 19:29:08 +0200 Subject: [PATCH 14/24] remove TokenV4 JSON, instead use mint unit proofs --- xx.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/xx.md b/xx.md index 6274ed2f..e3ee60ee 100644 --- a/xx.md +++ b/xx.md @@ -22,7 +22,8 @@ A Payment Request is defined as follows "i": str , "a": int , "u": str , - "r": Array[str] , + "r": bool , + "m": Array[str] , "d": str , "t": Transport } @@ -30,12 +31,13 @@ A Payment Request is defined as follows while Transport is defined as -- i: Payment id to be included in the payment payload -- a: The amount of the requested payment -- u: The unit of the requested payment (MUST be set if `a` is set) -- r: A set of mints from which the payment is requested -- d: A human readable description that the sending wallet will display after scanning the request -- t: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) +- `i`: Payment id to be included in the payment payload +- `a`: The amount of the requested payment +- `u`: The unit of the requested payment (MUST be set if `a` is set) +- `s`: Whether the payment request is for single use +- `m`: A set of mints from which the payment is requested +- `d`: A human readable description that the sending wallet will display after scanning the request +- `t`: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) ## Transport @@ -63,17 +65,21 @@ There are different transport layers: - type: `post` - target: `` +## Payment payload + Regardless of the transport layer, the payload sent to the receiver is a JSON serialized object as follows: ```json { "id": str , "memo": str , - "token": TokenV4_JSON + "mint": str, + "unit": , + "proofs": Array } ``` -Here, `id` is the payment id (corresponding to `i` in request), `memo` is an optional memo to be sent to the receiver with the payment, and `token` is a TokenV4 JSON object as specified in [NUT-00][00]. +Here, `id` is the payment id (corresponding to `i` in request), `memo` is an optional memo to be sent to the receiver with the payment, `mint` is the mint URL from which the ecash is from, `unit` is the unit of the payment, and `proofs` is an array of proofs (see [NUT-00][00], can also include DLEQ proofs). ## Encoded Request From 459d66f6b076cd32e729580c2e2721b4883a13a2 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Wed, 16 Oct 2024 20:10:04 +0200 Subject: [PATCH 15/24] add to readme --- xx.md => 18.md | 29 ++++++++++++++++++++--------- README.md | 30 ++++++++++++++++-------------- 2 files changed, 36 insertions(+), 23 deletions(-) rename xx.md => 18.md (73%) diff --git a/xx.md b/18.md similarity index 73% rename from xx.md rename to 18.md index e3ee60ee..ab476d15 100644 --- a/xx.md +++ b/18.md @@ -55,19 +55,30 @@ Transport specifies methods for sending the ecash to the receiver. A transport c - a: target of Transport - g: optional tags for the Transport -There are different transport layers: +### Transport types -- nostr - - type: `nostr` - - target: `` - - tags: `[["1", "NIP-04"], ["2", "NIP-17"], ["3", "NIP-61"]]` -- post - - type: `post` - - target: `` +The supported transport types are: + +#### Nostr + +- type: `nostr` +- target: `` +- tags: `[["NIP-04", "true"], ["NIP-17", "true"]]` + +The payment request MUST specify which type of Nostr message they support in the `tags`. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. + +Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. + +#### HTTP POST + +- type: `post` +- target: `` + +The execute the payment, the sender makes a `POST` request to the specified endpoint URL with the `PaymentRequestPayload` as the body. ## Payment payload -Regardless of the transport layer, the payload sent to the receiver is a JSON serialized object as follows: +If not specified otherwise, the payload sent to the receiver is a `PaymentRequestPayload` JSON serialized object as follows: ```json { diff --git a/README.md b/README.md index e0ca5195..8bbb4fe3 100644 --- a/README.md +++ b/README.md @@ -20,19 +20,20 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio ### Optional -| # | Description | Wallets | Mints | -| -------- | --------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------- | -| [07][07] | Token state check | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | -| [08][08] | Overpaid Lightning fees | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | -| [09][09] | Signature restore | [Nutshell][py], [cdk-cli], [cashu-ts][ts], [gonuts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [10][10] | Spending conditions | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [11][11] | Pay-To-Pubkey (P2PK) | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [13][13] | Deterministic secrets | [Nutshell][py], [Moksha][moksha], [cashu-ts][ts], [cdk-cli], [gonuts] | - | -| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py], [nutmix] | -| [16][16] | Animated QR codes | [Cashu.me][cashume] | - | -| [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | +| # | Description | Wallets | Mints | +| -------- | --------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------- | +| [07][07] | Token state check | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd] | +| [08][08] | Overpaid Lightning fees | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd] | +| [09][09] | Signature restore | [Nutshell][py], [cdk-cli], [cashu-ts][ts], [gonuts] | [Nutshell][py], [cdk-mintd] | +| [10][10] | Spending conditions | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [11][11] | Pay-To-Pubkey (P2PK) | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd] | +| [13][13] | Deterministic secrets | [Nutshell][py], [Moksha][moksha], [cashu-ts][ts], [cdk-cli], [gonuts] | - | +| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd] | +| [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py] | +| [16][16] | Animated QR codes | [Cashu.me][cashume] | - | +| [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | +| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - #### Wallets: @@ -45,7 +46,7 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio - [Nutstash][ns] - [Cashu.me][cashume] - [Gonuts][gonuts] -- [Boardwalk Cash][bwc] +- [Boardwalk][bwc] #### Mints: @@ -87,3 +88,4 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio [15]: 15.md [16]: 16.md [17]: 17.md +[18]: 18.md From 4989f52c27cc20ca91b3b8830a85ecac65940106 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Thu, 17 Oct 2024 00:27:11 +0200 Subject: [PATCH 16/24] fix transport and change tag --- 18.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/18.md b/18.md index ab476d15..5cb7effc 100644 --- a/18.md +++ b/18.md @@ -25,7 +25,7 @@ A Payment Request is defined as follows "r": bool , "m": Array[str] , "d": str , - "t": Transport + "t": Array[Transport] } ``` @@ -63,9 +63,9 @@ The supported transport types are: - type: `nostr` - target: `` -- tags: `[["NIP-04", "true"], ["NIP-17", "true"]]` +- tags: `[["m", "NIP-04"],["m", "NIP-17"]]` -The payment request MUST specify which type of Nostr message they support in the `tags`. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `m` tag MUST specify at least one type of Nostr direct message type the receiver supports. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. From ec3bfa32275525b8fc61c3c40b2d91913155115e Mon Sep 17 00:00:00 2001 From: gudnuf Date: Thu, 17 Oct 2024 11:46:28 -0700 Subject: [PATCH 17/24] change tags to support multiple values --- 18.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/18.md b/18.md index 5cb7effc..a6d7491e 100644 --- a/18.md +++ b/18.md @@ -53,19 +53,23 @@ Transport specifies methods for sending the ecash to the receiver. A transport c - t: type of Transport - a: target of Transport -- g: optional tags for the Transport +- g: optional tags for the Transport ### Transport types The supported transport types are: +### Tags + +Tags are an optional array of `[tag, value, value, ...]` tuples that can be used to specify additional features about the transport. A single tag can have multiple values. + #### Nostr - type: `nostr` - target: `` -- tags: `[["m", "NIP-04"],["m", "NIP-17"]]` +- tags: `[["n","04", "17"]]` -The `m` tag MUST specify at least one type of Nostr direct message type the receiver supports. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `n` tag specifies the NIPs the receiver supports. At lease one type of Nostr direct message MUST be specified. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. @@ -104,4 +108,4 @@ _Example_ creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag ``` -[00]: 00.md \ No newline at end of file +[00]: 00.md From 0663344be253f38e0fd7491073b40bb839b51514 Mon Sep 17 00:00:00 2001 From: gudnuf Date: Thu, 17 Oct 2024 12:45:00 -0700 Subject: [PATCH 18/24] remove NIP-04 --- 18.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/18.md b/18.md index a6d7491e..d16cdece 100644 --- a/18.md +++ b/18.md @@ -67,11 +67,11 @@ Tags are an optional array of `[tag, value, value, ...]` tuples that can be used - type: `nostr` - target: `` -- tags: `[["n","04", "17"]]` +- tags: `[["n", "17"]]` -The `n` tag specifies the NIPs the receiver supports. At lease one type of Nostr direct message MUST be specified. For [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) and [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. +The `n` tag specifies the NIPs the receiver supports. At least one tag value MUST be specified. For [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. -Note that the use of NIP-04 direct messages is strongly discouraged, since it reveals metadata about sender and receiver public keys. +[NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) SHOULDNT be used because it is deprecated and reveals metadata about sender and receiver public keys. #### HTTP POST From a2c617242e10e6c5b946e3a8b919a6dacdf2fdeb Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:39:34 +0200 Subject: [PATCH 19/24] readd nutix --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8bbb4fe3..81c92a8a 100644 --- a/README.md +++ b/README.md @@ -22,18 +22,18 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio | # | Description | Wallets | Mints | | -------- | --------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------- | -| [07][07] | Token state check | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd] | -| [08][08] | Overpaid Lightning fees | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd] | -| [09][09] | Signature restore | [Nutshell][py], [cdk-cli], [cashu-ts][ts], [gonuts] | [Nutshell][py], [cdk-mintd] | +| [07][07] | Token state check | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | +| [08][08] | Overpaid Lightning fees | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | +| [09][09] | Signature restore | [Nutshell][py], [cdk-cli], [cashu-ts][ts], [gonuts] | [Nutshell][py], [cdk-mintd], [nutmix] | | [10][10] | Spending conditions | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | | [11][11] | Pay-To-Pubkey (P2PK) | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd] | +| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | | [13][13] | Deterministic secrets | [Nutshell][py], [Moksha][moksha], [cashu-ts][ts], [cdk-cli], [gonuts] | - | -| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd] | +| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | | [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py] | | [16][16] | Animated QR codes | [Cashu.me][cashume] | - | | [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | -| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - +| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - #### Wallets: From 211864c9bb9a050dcf1039bf2f0428b22bcf64dd Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:41:49 +0200 Subject: [PATCH 20/24] prettier --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 81c92a8a..f0b745f5 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,20 @@ Wallets and mints `MUST` implement all mandatory specs and `CAN` implement optio ### Optional -| # | Description | Wallets | Mints | -| -------- | --------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------- | +| # | Description | Wallets | Mints | +| -------- | --------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------- | | [07][07] | Token state check | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | | [08][08] | Overpaid Lightning fees | [Nutshell][py], [Moksha][moksha], [Nutstash][ns], [cashu-ts][ts], [cdk-cli] | [Nutshell][py], [Moksha][moksha], [cdk-mintd], [nutmix] | | [09][09] | Signature restore | [Nutshell][py], [cdk-cli], [cashu-ts][ts], [gonuts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [10][10] | Spending conditions | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [11][11] | Pay-To-Pubkey (P2PK) | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [13][13] | Deterministic secrets | [Nutshell][py], [Moksha][moksha], [cashu-ts][ts], [cdk-cli], [gonuts] | - | -| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | -| [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py] | -| [16][16] | Animated QR codes | [Cashu.me][cashume] | - | -| [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | -| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - +| [10][10] | Spending conditions | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [11][11] | Pay-To-Pubkey (P2PK) | [Nutshell][py], [cdk-cli], [cashu-ts][ts] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [12][12] | DLEQ proofs | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [13][13] | Deterministic secrets | [Nutshell][py], [Moksha][moksha], [cashu-ts][ts], [cdk-cli], [gonuts] | - | +| [14][14] | Hashed Timelock Contracts (HTLCs) | [Nutshell][py], [cdk-cli] | [Nutshell][py], [cdk-mintd], [nutmix] | +| [15][15] | Partial multi-path payments (MPP) | [Nutshell][py] | [Nutshell][py] | +| [16][16] | Animated QR codes | [Cashu.me][cashume] | - | +| [17][17] | WebSocket subscriptions | [Nutshell][py] | [Nutshell][py] | +| [18][18] | Payment requests | [Cashu.me][cashume], [Boardwalk][bwc] | - | #### Wallets: From 4ec6ec7593dca4f970a9ba33f6a2da442a7abce6 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:41:23 +0200 Subject: [PATCH 21/24] Update 18.md Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com> --- 18.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/18.md b/18.md index d16cdece..5bfa966a 100644 --- a/18.md +++ b/18.md @@ -1,4 +1,4 @@ -# NUT-XX: Payment Requests +# NUT-18: Payment Requests `optional` From 8002b5bb670376776a74752cfb2d79f5df4c744e Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:44:46 +0200 Subject: [PATCH 22/24] remove wrong line --- 18.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/18.md b/18.md index 5bfa966a..aa0da11d 100644 --- a/18.md +++ b/18.md @@ -28,8 +28,7 @@ A Payment Request is defined as follows "t": Array[Transport] } ``` - -while Transport is defined as +Here, the fields are - `i`: Payment id to be included in the payment payload - `a`: The amount of the requested payment @@ -37,11 +36,11 @@ while Transport is defined as - `s`: Whether the payment request is for single use - `m`: A set of mints from which the payment is requested - `d`: A human readable description that the sending wallet will display after scanning the request -- `t`: The method of transport chosen to transmit the payment (can be multiple, sorted by preference) +- `t`: The method of `Transport` chosen to transmit the payment (can be multiple, sorted by preference) ## Transport -Transport specifies methods for sending the ecash to the receiver. A transport consists of a type and a target. +`Transport` specifies methods for sending the ecash to the receiver. A transport consists of a type and a target. ```json { From 09d70ec1431c8f492fdcf523c3dc3c91babb3c6a Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:57:06 +0200 Subject: [PATCH 23/24] add example --- 18.md | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/18.md b/18.md index aa0da11d..778fa13b 100644 --- a/18.md +++ b/18.md @@ -50,18 +50,18 @@ Here, the fields are } ``` -- t: type of Transport -- a: target of Transport -- g: optional tags for the Transport - -### Transport types - -The supported transport types are: +- `t`: type of Transport +- `a`: target of Transport +- `g`: optional tags for the Transport ### Tags Tags are an optional array of `[tag, value, value, ...]` tuples that can be used to specify additional features about the transport. A single tag can have multiple values. +### Transport types + +The supported transport types are described below. + #### Nostr - type: `nostr` @@ -70,8 +70,6 @@ Tags are an optional array of `[tag, value, value, ...]` tuples that can be used The `n` tag specifies the NIPs the receiver supports. At least one tag value MUST be specified. For [NIP-17](https://github.com/nostr-protocol/nips/blob/master/17.md) direct messages, the sender sends a `PaymentRequestPayload` as the message content. -[NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) SHOULDNT be used because it is deprecated and reveals metadata about sender and receiver public keys. - #### HTTP POST - type: `post` @@ -101,10 +99,30 @@ The payment request is serialized using CBOR, encoded in `base64_urlsafe`, toget `"creq" + "A" + base64(CBOR(PaymentRequest))` -_Example_ +### Example + +This is an example payment request expressed as JSON: + +```json +{ + "i": "b7a90176", + "a": 10, + "u": "sat", + "m": ["https://nofees.testnut.cashu.space"], + "t": [ + { + "t": "nostr", + "a": "nprofile1qy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsz9mhwden5te0wfjkccte9curxven9eehqctrv5hszrthwden5te0dehhxtnvdakqqgydaqy7curk439ykptkysv7udhdhu68sucm295akqefdehkf0d495cwunl5", + "g": [["n","17"]] + } + ] +} +``` + +This payment request serializes to (see [here](https://cbor.nemo157.com/#type=hex&value=a3617482a261694800ffd48b8f5ecf80617081a36161016173784061636331323433356537623834383463336366313835303134393231386166393066373136613532626634613565643334376534386563633133663737333838616358210244538319de485d55bed3b29a642bee5879375ab9e7a620e11e48ba482421f3cfa261694800ad268c4d1f5826617082a3616102617378403133323364336434373037613538616432653233616461346539663166343966356135623461633762373038656230643631663733386634383330376538656561635821023456aa110d84b4ac747aebd82c3b005aca50bf457ebd5737a4414fac3ae7d94da36161016173784035366263626362623763633634303662336661356435376432313734663465666638623434303262313736393236643361353764336333646362623539643537616358210273129c5719e599379a974a626363c333c56cafc0e6d01abe46d5808280789c63616d75687474703a2f2f6c6f63616c686f73743a33333338617563736174)): ```sh -creqAaVhQRVhVWNzYXRhTXgiaHR0cHM6Ly9taW50Lm1pbmliaXRzLmNhc2gvQml0Y29pbmFEeCNQbGVzYXNlIHBheSB0aGUgdmVyeSBmaXJzdCBjYXNodSBwcmFUgaJhVGVub3N0cmJUYXhGbnByb2ZpbGUxcXFzZG11cDZlMno2bWNwZXVlNno2a2wwOGhlNDloY2VuNXhucmMzdG5wdncwbWRndGplbWgwc3V4YTBrag +creqApWF0gaNhdGVub3N0cmFheKlucHJvZmlsZTFxeTI4d3VtbjhnaGo3dW45ZDNzaGp0bnl2OWtoMnVld2Q5aHN6OW1od2RlbjV0ZTB3ZmprY2N0ZTljdXJ4dmVuOWVlaHFjdHJ2NWhzenJ0aHdkZW41dGUwZGVoaHh0bnZkYWtxcWd5ZGFxeTdjdXJrNDM5eWtwdGt5c3Y3dWRoZGh1NjhzdWNtMjk1YWtxZWZkZWhrZjBkNDk1Y3d1bmw1YWeBgmFuYjE3YWloYjdhOTAxNzZhYQphdWNzYXRhbYF4Imh0dHBzOi8vbm9mZWVzLnRlc3RudXQuY2FzaHUuc3BhY2U= ``` [00]: 00.md From c09e45f4a5898f94fe94a4ae359d6c9a5dc29142 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:57:20 +0200 Subject: [PATCH 24/24] prettier --- 18.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/18.md b/18.md index 778fa13b..7b2b3e93 100644 --- a/18.md +++ b/18.md @@ -28,6 +28,7 @@ A Payment Request is defined as follows "t": Array[Transport] } ``` + Here, the fields are - `i`: Payment id to be included in the payment payload @@ -113,9 +114,9 @@ This is an example payment request expressed as JSON: { "t": "nostr", "a": "nprofile1qy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsz9mhwden5te0wfjkccte9curxven9eehqctrv5hszrthwden5te0dehhxtnvdakqqgydaqy7curk439ykptkysv7udhdhu68sucm295akqefdehkf0d495cwunl5", - "g": [["n","17"]] + "g": [["n", "17"]] } - ] + ] } ```