From 4cf6ea7137151a5e41976526aa1b6570d04df950 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 11:40:25 +0100 Subject: [PATCH 01/11] added nostr cash --- 88.md | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 88.md diff --git a/88.md b/88.md new file mode 100644 index 00000000..62ee3420 --- /dev/null +++ b/88.md @@ -0,0 +1,189 @@ +NIP-15 +====== + +Nostr Cash (simple Nostr ecash) +----------------------------------- + +`draft` `optional` `author:benarc` + +> Nostr Cash is not blinded by default. + +Ecash is useful and relays should have the option to offer ecash mints. Other mints could exist as stand-alone clients, but relays are ideally placed to package in with their service offerings. + +Users can use relays offering mints they trust, or mints and relays they don't trust but for smaller amounts. + +The relay must have a keypair and an additional keypair for its mint. + +Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). + +All communication between the relay and user happen over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). + +The mints ledger is two tables `active` and `spent`: + +``` +active: + key: , + amount: , + user: , + timestamp: + +spent: + key: , + amount: , + user: , + timestamp: +``` + +User client ecash wallet stores: + +``` +active: + key: , + amount: , + relay: , + relaykey: , + timestamp: + +spent: + key: , + amount: , + relay: , + relaykey: , + timestamp: +``` + +## Workflows + +### Mint details + +User DMs the relay: + +```json +{ + "mint": +} +``` + +Relay DMs user (maybe after a check if the relays mint has restricted access): + +```json +{ + "title": , + "description": , + "liquiity": , + "type": , + "fee": , +} +``` + +### Minting + +User DMs the relay: + +```json +{ + "amount": +} +``` + +Relay responds with payment request, which user pays: + +```json{ +{ + "request": , +} +``` + +Once paid the mint generates derived keypair from the mints private key, storing in table `active`: + +```json +{ + "key": , + "amount": , + "user": +} +``` + +Mint replies: + +```json +{ + "key": , + "amount": +} +``` + +User client stores: + +```json +{ + "key": , + "amount": , + "relay": , + "relaykey": , + "timestamp": , + "amount": , + "type": +} +``` + +Relay DMs user: + +```json +{ + "type": +} +``` + +User DMs relay: + +```json +{ + "request": , +} +``` + +### Sending + +User DMs relay: + +```json +{ + "key": , + "amount": , + "type": +} +``` + +Mint `burns` the old record for the ecash and creates a new record(s), depending on if sending user is owed change (the old record from `active` to `spent` table). The mint creates a new record in `active` and DMs the recipient user the private-key/ecash. If change is due, another record is created in `active` and sent back to the sender user. + +Relay DMs user(s): + +```json +{ + "key": , + "amount": +} +``` + +User(s) client stores: + +```json +{ + "key": , + "amount": , + "relay": , + "relaykey": , + "timestamp": Date: Thu, 29 Jun 2023 11:51:14 +0100 Subject: [PATCH 02/11] Update 88.md --- 88.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/88.md b/88.md index 62ee3420..fce34a6f 100644 --- a/88.md +++ b/88.md @@ -10,9 +10,9 @@ Nostr Cash (simple Nostr ecash) Ecash is useful and relays should have the option to offer ecash mints. Other mints could exist as stand-alone clients, but relays are ideally placed to package in with their service offerings. -Users can use relays offering mints they trust, or mints and relays they don't trust but for smaller amounts. +Users can use relays offering mints they trust, or relays they don't trust but for smaller amounts. -The relay must have a keypair and an additional keypair for its mint. +Relays offering mints must have a keypair and an additional nostr keypair for its mint. Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). From a0bf41e8606cc60528fae3e2e9f60406a7229670 Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:53:08 +0100 Subject: [PATCH 03/11] Update 88.md --- 88.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/88.md b/88.md index fce34a6f..bcb92122 100644 --- a/88.md +++ b/88.md @@ -90,7 +90,7 @@ Relay responds with payment request, which user pays: ```json{ { - "request": , + "request": , } ``` From c831ee252fe319b149960c8ef7edf803048831ff Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:53:36 +0100 Subject: [PATCH 04/11] Update 88.md --- 88.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/88.md b/88.md index bcb92122..b2334105 100644 --- a/88.md +++ b/88.md @@ -90,7 +90,7 @@ Relay responds with payment request, which user pays: ```json{ { - "request": , + "request": , } ``` From 72d686ff3ae834674ebc92659515052b655668e9 Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Thu, 29 Jun 2023 11:53:47 +0100 Subject: [PATCH 05/11] Update 88.md --- 88.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/88.md b/88.md index b2334105..01356395 100644 --- a/88.md +++ b/88.md @@ -1,4 +1,4 @@ -NIP-15 +NIP-88 ====== Nostr Cash (simple Nostr ecash) From 6c273e42bfff126cc7305c365c4b8cc967d91f87 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 11:57:14 +0100 Subject: [PATCH 06/11] typo --- 88.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/88.md b/88.md index 01356395..625ac86d 100644 --- a/88.md +++ b/88.md @@ -90,7 +90,7 @@ Relay responds with payment request, which user pays: ```json{ { - "request": , + "request": , } ``` @@ -100,7 +100,7 @@ Once paid the mint generates derived keypair from the mints private key, storing { "key": , "amount": , - "user": + "user": } ``` @@ -119,7 +119,7 @@ User client stores: { "key": , "amount": , - "relay": , + "relay": , "relaykey": , "timestamp": Date: Thu, 29 Jun 2023 11:58:37 +0100 Subject: [PATCH 07/11] typos --- 88.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/88.md b/88.md index 625ac86d..4357386f 100644 --- a/88.md +++ b/88.md @@ -88,9 +88,9 @@ User DMs the relay: Relay responds with payment request, which user pays: -```json{ +```json { - "request": , + "request": } ``` @@ -121,7 +121,7 @@ User client stores: "amount": , "relay": , "relaykey": , - "timestamp": } ``` @@ -184,6 +184,6 @@ User(s) client stores: "amount": , "relay": , "relaykey": , - "timestamp": } ``` From aef4ad0e53d6dfb36600c835c2faef7e30774d2c Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 11:59:25 +0100 Subject: [PATCH 08/11] typo --- 88.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/88.md b/88.md index 4357386f..133e9bde 100644 --- a/88.md +++ b/88.md @@ -165,7 +165,7 @@ User DMs relay: } ``` -Mint `burns` the old record for the ecash and creates a new record(s), depending on if sending user is owed change (the old record from `active` to `spent` table). The mint creates a new record in `active` and DMs the recipient user the private-key/ecash. If change is due, another record is created in `active` and sent back to the sender user. +Mint `burns` the old record for the ecash and creates a new record(s), depending on if sending user is owed change (the old record moves from `active` to `spent` table). The mint creates a new record in `active` and DMs the recipient user the private-key/ecash. If change is due, another record is created in `active` and sent back to the sender user. Relay DMs user(s): From d3b5da312d7a6db400bdf68a369debfae6479ab5 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 12:08:28 +0100 Subject: [PATCH 09/11] adding descriptions for workflows --- 88.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/88.md b/88.md index 133e9bde..be536612 100644 --- a/88.md +++ b/88.md @@ -78,6 +78,8 @@ Relay DMs user (maybe after a check if the relays mint has restricted access): ### Minting +**For creating new ecash from a mint.** + User DMs the relay: ```json @@ -127,6 +129,8 @@ User client stores: ### Claiming +**For cashing in ecash with the mint.** + User DMs relay: ```json @@ -155,6 +159,8 @@ User DMs relay: ### Sending +**For sending ecash to another nostr user.** + User DMs relay: ```json From b0526aec4dd57d358a3d4ec90739a723d3f8dd18 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 12:11:06 +0100 Subject: [PATCH 10/11] Expanded explanation --- 88.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/88.md b/88.md index be536612..4348fea7 100644 --- a/88.md +++ b/88.md @@ -14,7 +14,7 @@ Users can use relays offering mints they trust, or relays they don't trust but f Relays offering mints must have a keypair and an additional nostr keypair for its mint. -Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). +Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). Each "ecash" is actually just a derived privatekey that can be burned or passed to another user. All communication between the relay and user happen over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). From 933674fea07df029ee58a461e755b3494fef21f2 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 12:13:44 +0100 Subject: [PATCH 11/11] added explanation --- 88.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/88.md b/88.md index 4348fea7..922ed73a 100644 --- a/88.md +++ b/88.md @@ -14,7 +14,7 @@ Users can use relays offering mints they trust, or relays they don't trust but f Relays offering mints must have a keypair and an additional nostr keypair for its mint. -Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). Each "ecash" is actually just a derived privatekey that can be burned or passed to another user. +Nostr Cash uses derived keys, much like [NIP26](https://github.com/nostr-protocol/nips/blob/master/26.md). Each "ecash" is actually just a derived private key that can be burned or passed to another user. All communication between the relay and user happen over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). @@ -56,6 +56,8 @@ spent: ### Mint details +For fetching info about the mint. + User DMs the relay: ```json