From cf71afb42d2bbcab50c1dcd9a96ebc11e03100f9 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 29 Jun 2023 12:14:01 +0100 Subject: [PATCH] added nostr cash Update 88.md Update 88.md Update 88.md Update 88.md typo typos typo adding descriptions for workflows Expanded explanation added explanation --- 88.md | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 88.md diff --git a/88.md b/88.md new file mode 100644 index 00000000..922ed73a --- /dev/null +++ b/88.md @@ -0,0 +1,197 @@ +NIP-88 +====== + +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 relays they don't trust but for smaller amounts. + +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 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). + +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 + +For fetching info about the mint. + +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 + +**For creating new ecash from a mint.** + +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": +} +``` + +### Claiming + +**For cashing in ecash with the mint.** + +User DMs relay: + +```json +{ + "key": , + "amount": , + "type": +} +``` + +Relay DMs user: + +```json +{ + "type": +} +``` + +User DMs relay: + +```json +{ + "request": , +} +``` + +### Sending + +**For sending ecash to another nostr user.** + +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 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): + +```json +{ + "key": , + "amount": +} +``` + +User(s) client stores: + +```json +{ + "key": , + "amount": , + "relay": , + "relaykey": , + "timestamp": +} +```