upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/60.md
diff options
context:
space:
mode:
Diffstat (limited to '60.md')
-rw-r--r--60.md18
1 files changed, 13 insertions, 5 deletions
diff --git a/60.md b/60.md
index 64cd282..a53efeb 100644
--- a/60.md
+++ b/60.md
@@ -12,10 +12,12 @@ The purpose of this NIP is:
12 12
13This NIP doesn't deal with users' *receiving* money from someone else, it's just to keep state of the user's wallet. 13This NIP doesn't deal with users' *receiving* money from someone else, it's just to keep state of the user's wallet.
14 14
15# High-level flow 15# Event Kinds
161. A user has a `kind:37375` event that represents a wallet. 16- `kind:37375` contains relevant info for a wallet. Clients **SHOULD** check the current info event when loading the wallet.
172. A user has `kind:7375` events that represent the unspent proofs of the wallet. -- The proofs are encrypted with the user's private key. 17- `kind:7373` wallet's reserved proofs. The proofs **MUST** be nip44-encrypted with the user's private key.
183. A user has `kind:7376` events that represent the spending history of the wallet -- This history is for informational purposes only and is completely optional. 18- `kind:7374` tracks pending quotes from a mint. This event **MAY** be used to keep track of the quote ID and its expiration.
19- `kind:7375` represents the wallet's unspent proofs. The proofs **MUST** be nip44-encrypted with the user's private key.
20- `kind:7376` provides the wallet's transaction history. The history is provided only for informational purposes and is not part of the wallet state.
19 21
20## Wallet Event 22## Wallet Event
21```jsonc 23```jsonc
@@ -57,7 +59,7 @@ Any tag, other than the `d` tag, can be [[NIP-44]] encrypted into the `.content`
57Due to PRE being hard to delete, if a user wants to delete a wallet, they should empty the event and keep just the `d` identifier and add a `deleted` tag. 59Due to PRE being hard to delete, if a user wants to delete a wallet, they should empty the event and keep just the `d` identifier and add a `deleted` tag.
58 60
59## Token Event 61## Token Event
60Token events are used to record the unspent proofs that come from the mint. 62Token events are used to store proofs of a wallet.
61 63
62There can be multiple `kind:7375` events for the same mint, and multiple proofs inside each `kind:7375` event. 64There can be multiple `kind:7375` events for the same mint, and multiple proofs inside each `kind:7375` event.
63 65
@@ -87,6 +89,9 @@ There can be multiple `kind:7375` events for the same mint, and multiple proofs
87### Spending proofs 89### Spending proofs
88When one or more proofs of a token are spent, the token event should be [[NIP-09]]-deleted and, if some proofs are unspent from the same token event, a new token event should be created rolling over the unspent proofs and adding any change outputs to the new token event. 90When one or more proofs of a token are spent, the token event should be [[NIP-09]]-deleted and, if some proofs are unspent from the same token event, a new token event should be created rolling over the unspent proofs and adding any change outputs to the new token event.
89 91
92### Reserving proofs
93A wallet can reserve proofs by deleting them from a `kind:7375` event and creating a `kind:7373` event. `kind:7373` and `kind:7375` events have the same structure.
94
90## Spending History Event 95## Spending History Event
91Clients SHOULD publish `kind:7376` events to create a transaction history when their balance changes. 96Clients SHOULD publish `kind:7376` events to create a transaction history when their balance changes.
92 97
@@ -203,3 +208,6 @@ Application developers are encouraged to use local state when possible and only
203 208
204## Appendix 1: Validating proofs 209## Appendix 1: Validating proofs
205Clients can optionally validate proofs to make sure they are not working from an old state; this logic is left up to particular implementations to decide when and why to do it, but if some proofs are checked and deemed to have been spent, the client should delete the token and roll over any unspent proof. 210Clients can optionally validate proofs to make sure they are not working from an old state; this logic is left up to particular implementations to decide when and why to do it, but if some proofs are checked and deemed to have been spent, the client should delete the token and roll over any unspent proof.
211
212## Appendix 2: Validating relays
213Clients might want to optionally check that the relays the user chooses to store the proofs respond well to [[NIP-09]] event deletion requests and, periodically, check that the different relays are consistent with the state they report. These checks are left up to particular implementations to decide when and why to do them. \ No newline at end of file