diff --git a/88.md b/88.md new file mode 100644 index 00000000..b68bd663 --- /dev/null +++ b/88.md @@ -0,0 +1,197 @@ +NIP-88 +====== + +Nostr Cash (simple Nostr cash/token/cheque) +----------------------------------- + +`draft` `optional` `author:benarc` + +Electronic cash is useful and relays should have the option to offer minting/custodial services. Other mints could exist as stand-alone clients, but relays are ideally placed to package in with their service offerings. + +Nostr Cash is simple and flexible. User gives a mint some money and the mint issues the user electromic cash/cheque/token that can be used as money in nostr. + +Nostr Cash is entirely custodial and trust based, and is just a common standard for users to send/receive value in nostr. Keeping mints simple means more users can run, for themselves, their family, or the whole world. + +Relays offering mints must have a keypair and an additional nostr keypair for its mint. + +Nostr Cash uses derived keys, much like [NIP06](https://github.com/nostr-protocol/nips/blob/master/06.md). Each "cash" 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 cash 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 cash 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 to user: + +```json +{ + "key": , + "amount": +} +``` + +User client stores: + +```json +{ + "key": , + "amount": , + "relay": , + "relaykey": , + "timestamp": +} +``` + +### Claiming + +**For cashing in cash with the mint.** + +User DMs relay: + +```json +{ + "key": , + "amount": , + "type": +} +``` + +Relay DMs user: + +```json +{ + "type": +} +``` + +User DMs relay: + +```json +{ + "request": , +} +``` + +### Sending + +**For sending cash to another nostr user.** + +User DMs relay: + +```json +{ + "key": , + "amount": , + "type": +} +``` + +Mint `burns` the old record for the cash 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/cash. 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": +} +``` diff --git a/NIP-121.md b/NIP-121.md new file mode 100644 index 00000000..49d1614a --- /dev/null +++ b/NIP-121.md @@ -0,0 +1,19 @@ +NIP-121 +====== + +Unicast event `"tags": "r"` +------------------------------- + +`draft` `mandatory` `author:benarc` + +`route` list of relays as a new tag `"r"`, to help create a unicast route for an events. + +```json +{ + "tags": [ + ["r", ""] + ] +} +``` + +A client receives an event with tag `"r"`, if the client received the event from a relay in the list and it has a connection with the next relay in the list, the client will pass the event to that relay. \ No newline at end of file