mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-12 18:36:24 +00:00
Compare commits
29 Commits
b188ab39fb
...
e2a1632290
Author | SHA1 | Date | |
---|---|---|---|
|
e2a1632290 | ||
|
a1ca7a194b | ||
|
4fa5b4f997 | ||
|
fa086e0c6a | ||
|
8bb004db59 | ||
|
131b1cca4f | ||
|
d3a2cddbc6 | ||
|
b57abac1d5 | ||
|
29a8368678 | ||
|
feba8cf6a1 | ||
|
2198147d2b | ||
|
10407208a6 | ||
|
56dcdb3075 | ||
|
3cf4a54aad | ||
|
cf71afb42d | ||
|
933674fea0 | ||
|
b0526aec4d | ||
|
d3b5da312d | ||
|
aef4ad0e53 | ||
|
bd584464c0 | ||
|
6c273e42bf | ||
|
72d686ff3a | ||
|
c831ee252f | ||
|
a0bf41e860 | ||
|
88c52fc45c | ||
|
4cf6ea7137 | ||
|
57e9e8d92f | ||
|
d82b733182 | ||
|
3815a6fd09 |
4
29.md
4
29.md
@ -30,8 +30,6 @@ When encountering just the `<host>` without the `'<group-id>`, clients MAY infer
|
||||
|
||||
Events sent by users to groups (chat messages, text notes, moderation events etc) MUST have an `h` tag with the value set to the group _id_.
|
||||
|
||||
`h` tags MAY include the group's name as the second argument. This allows `unmanaged` groups to be assigned human-readable names without relay support.
|
||||
|
||||
## Timeline references
|
||||
|
||||
In order to not be used out of context, events sent to these groups may contain references to previous events seen from the same relay in the `previous` tag. The choice of which previous events to pick belongs to the clients. The references are to be made using the first 8 characters (4 bytes) of any event in the last 50 events seen by the user in the relay, excluding events by themselves. There can be any number of references (including zero), but it's recommended that clients include at least 3 and that relays enforce this.
|
||||
@ -242,3 +240,5 @@ A definition for `kind:10009` was included in [NIP-51](51.md) that allows client
|
||||
### Using `unmanaged` relays
|
||||
|
||||
To prevent event leakage, when using `unmanaged` relays, clients should include the [NIP-70](70.md) `-` tag, as just the `previous` tag won't be checked by other `unmanaged` relays.
|
||||
|
||||
Groups MAY be named without relay support by adding a `name` to the corresponding tag in a user's `kind 10009` group list.
|
||||
|
2
51.md
2
51.md
@ -29,7 +29,7 @@ For example, _mute list_ can contain the public keys of spammers and bad actors
|
||||
| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) |
|
||||
| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) |
|
||||
| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) |
|
||||
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL), `"r"` for each relay in use |
|
||||
| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group id + relay URL + optional group name), `"r"` for each relay in use |
|
||||
| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a"` (kind:30015 interest set) |
|
||||
| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) |
|
||||
| DM relays | 10050 | Where to receive [NIP-17](17.md) direct messages | `"relay"` (see [NIP-17](17.md)) |
|
||||
|
197
88.md
Normal file
197
88.md
Normal file
@ -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>
|
||||
}
|
||||
```
|
19
NIP-121.md
Normal file
19
NIP-121.md
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user