-
Notifications
You must be signed in to change notification settings - Fork 504
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
NIP-88 WIP Nostr Cash #627
Open
arcbtc
wants to merge
27
commits into
nostr-protocol:master
Choose a base branch
from
arcbtc:nostrcash
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+216
−0
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3815a6f
init
arcbtc d82b733
Merge pull request #3 from arcbtc/nips121
arcbtc 57e9e8d
Merge branch 'master' into mymaster
arcbtc 4cf6ea7
added nostr cash
arcbtc 88c52fc
Update 88.md
arcbtc a0bf41e
Update 88.md
arcbtc c831ee2
Update 88.md
arcbtc 72d686f
Update 88.md
arcbtc 6c273e4
typo
arcbtc bd58446
typos
arcbtc aef4ad0
typo
arcbtc d3b5da3
adding descriptions for workflows
arcbtc b0526ae
Expanded explanation
arcbtc 933674f
added explanation
arcbtc cf71afb
added nostr cash
arcbtc 3cf4a54
format
arcbtc 56dcdb3
Merge remote-tracking branch 'arcbtc/nostrcash' into nostrcash
arcbtc 1040720
added ecash disclaimer
arcbtc 2198147
disclaimer elaborated on
arcbtc feba8cf
removed ecash mention, its not ecash
arcbtc 29a8368
Update 88.md
arcbtc b57abac
Update 88.md
arcbtc d3a2cdd
Update 88.md
arcbtc 131b1cc
Update 88.md
arcbtc 8bb004d
Update 88.md
arcbtc fa086e0
Update 88.md
arcbtc 4fa5b4f
Update 88.md
arcbtc File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: <integer, keypair deriviation number from master>, | ||
amount: <integer BTC millisat denomination>, | ||
user: <string, public-key of user>, | ||
timestamp: <integer timestamp> | ||
|
||
spent: | ||
key: <integer, keypair deriviation number from master>, | ||
amount: <integer BTC millisat denomination>, | ||
user: <string, public-key of user>, | ||
timestamp: <integer timestamp> | ||
``` | ||
|
||
User client cash wallet stores: | ||
|
||
``` | ||
active: | ||
key: <string, derived private key/cash>, | ||
amount: <integer BTC millisat denomination>, | ||
relay: <string, relay ws address>, | ||
relaykey: <string, public-key of relay>, | ||
timestamp: <integer timestamp> | ||
|
||
spent: | ||
key: <string, derived private key/cash>, | ||
amount: <integer BTC millisat denomination>, | ||
relay: <string, relay ws address>, | ||
relaykey: <string, public-key of relay>, | ||
timestamp: <integer timestamp> | ||
``` | ||
|
||
## Workflows | ||
|
||
### Mint details | ||
|
||
**For fetching info about the mint.** | ||
|
||
User DMs the relay: | ||
|
||
```json | ||
{ | ||
"mint": <bool true> | ||
} | ||
``` | ||
|
||
Relay DMs user (maybe after a check if the relays mint has restricted access): | ||
|
||
```json | ||
{ | ||
"title": <string mints title>, | ||
"description": <string mints description>, | ||
"liquiity": <integer optional public millisat balance of mint>, | ||
"type": <list different offered payment types bolt11 bolt12 onchain stripe paypal shitcoin etc>, | ||
"fee": <integer millisat fee for internal nostr payments>, | ||
} | ||
``` | ||
|
||
### Minting | ||
|
||
**For creating new cash from a mint.** | ||
|
||
User DMs the relay: | ||
|
||
```json | ||
{ | ||
"amount": <integer millisats> | ||
} | ||
``` | ||
|
||
Relay responds with payment request, which user pays: | ||
|
||
```json | ||
{ | ||
"request": <string payment request bolt11 bolt12 onchain stripe paypal shitcoin etc> | ||
} | ||
``` | ||
|
||
Once paid the mint generates derived keypair from the mints private key, storing in table `active`: | ||
|
||
```json | ||
{ | ||
"key": <integer derived keypair number>, | ||
"amount": <integer BTC millisat denomination>, | ||
"user": <string public-key of user> | ||
} | ||
``` | ||
|
||
Mint replies to user: | ||
|
||
```json | ||
{ | ||
"key": <string derived private key/cash>, | ||
"amount": <integer BTC millisat denomination> | ||
} | ||
``` | ||
|
||
User client stores: | ||
|
||
```json | ||
{ | ||
"key": <string derived private key/cash>, | ||
"amount": <integer BTC millisat denomination>, | ||
"relay": <string relay ws address>, | ||
"relaykey": <string public-key of relay>, | ||
"timestamp": <integer timestamp> | ||
} | ||
``` | ||
|
||
### Claiming | ||
|
||
**For cashing in cash with the mint.** | ||
|
||
User DMs relay: | ||
|
||
```json | ||
{ | ||
"key": <String, derived private key/cash>, | ||
"amount": <Integer, BTC millisat denomination>, | ||
"type": <String, preffered payment method bolt11 bolt12 onchain stripe paypal shitcoin etc> | ||
} | ||
``` | ||
|
||
Relay DMs user: | ||
|
||
```json | ||
{ | ||
"type": <String, bolt11 bolt12 onchain stripe paypal shitcoin etc> | ||
} | ||
``` | ||
|
||
User DMs relay: | ||
|
||
```json | ||
{ | ||
"request": <String, payment-request bolt11 bolt12 onchain stripe paypal shitcoin etc>, | ||
} | ||
``` | ||
|
||
### Sending | ||
|
||
**For sending cash to another nostr user.** | ||
|
||
User DMs relay: | ||
|
||
```json | ||
{ | ||
"key": <String, derived private key/cash>, | ||
"amount": <Integer, BTC millisat denomination>, | ||
"type": <String, public key of recipient> | ||
} | ||
``` | ||
|
||
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": <string derived private key/cash>, | ||
"amount": <integer BTC millisat denomination> | ||
} | ||
``` | ||
|
||
User(s) client stores: | ||
|
||
```json | ||
{ | ||
"key": <string derived private key/cash>, | ||
"amount": <integer BTC millisat denomination>, | ||
"relay": <string, relay ws address>, | ||
"relaykey": <string public-key of relay>, | ||
"timestamp": <integer timestamp> | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", "<csv of relay IDs>"] | ||
] | ||
} | ||
``` | ||
|
||
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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use NIP-15 payment_options for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Great