From ba46b23d95b186c9a8fedabf8324af2ae40e8ce4 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez
Date: Fri, 25 Oct 2024 17:54:49 +0100
Subject: Cashu wallet + Nutzaps (#1369)
---
60.md | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 205 insertions(+)
create mode 100644 60.md
(limited to '60.md')
diff --git a/60.md b/60.md
new file mode 100644
index 0000000..2f24841
--- /dev/null
+++ b/60.md
@@ -0,0 +1,205 @@
+# NIP-60
+## Cashu Wallet
+`draft` `optional`
+
+This NIP defines the operations of a cashu-based wallet.
+
+A cashu wallet is a wallet which information is stored in relays to make it accessible across applications.
+
+The purpose of this NIP is:
+* ease-of-use: new users immediately are able to receive funds without creating accounts with other services.
+* interoperability: users' wallets follows them across applications.
+
+This NIP doesn't deal with users' *receiving* money from someone else, it's just to keep state of the user's wallet.
+
+# High-level flow
+1. A user has a `kind:37375` event that represents a wallet.
+2. A user has `kind:7375` events that represent the unspent proofs of the wallet. -- The proofs are encrypted with the user's private key.
+3. 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.
+
+## Wallet Event
+```jsonc
+{
+ "kind": 37375,
+ "content": nip44_encrypt([
+ [ "balance", "100", "sat" ],
+ [ "privkey", "hexkey" ] // explained in NIP-61
+ ]),
+ "tags": [
+ [ "d", "my-wallet" ],
+ [ "mint", "https://mint1" ],
+ [ "mint", "https://mint2" ],
+ [ "mint", "https://mint3" ],
+ [ "name", "my shitposting wallet" ],
+ [ "unit", "sat" ],
+ [ "description", "a wallet for my day-to-day shitposting" ],
+ [ "relay", "wss://relay1" ],
+ [ "relay", "wss://relay2" ],
+ ]
+}
+```
+
+The wallet event is a parameterized replaceable event `kind:37375`.
+
+Tags:
+* `d` - wallet ID.
+* `mint` - Mint(s) this wallet uses -- there MUST be one or more mint tags.
+* `relay` - Relays where the wallet and related events can be found. -- one ore more relays SHOULD be specified. If missing, clients should follow [[NIP-65]].
+* `unit` - Base unit of the wallet (e.g. "sat", "usd", etc).
+* `name` - Optional human-readable name for the wallet.
+* `description` - Optional human-readable description of the wallet.
+* `balance` - Optional best-effort balance of the wallet that can serve as a placeholder while an accurate balance is computed from fetching all unspent proofs.
+* `privkey` - Private key used to unlock P2PK ecash. MUST be stored encrypted in the `.content` field. **This is a different private key exclusively used for the wallet, not associated in any way to the user's nostr private key** -- This is only used when receiving funds from others, described in NIP-61.
+
+Any tag, other than the `d` tag, can be [[NIP-44]] encrypted into the `.content` field.
+
+### Deleting a wallet event
+Due 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.
+
+## Token Event
+Token events are used to record the unspent proofs that come from the mint.
+
+There can be multiple `kind:7375` events for the same mint, and multiple proofs inside each `kind:7375` event.
+
+```jsonc
+{
+ "kind": 7375,
+ "content": nip44_encrypt({
+ "mint": "https://stablenut.umint.cash",
+ "proofs": [
+ {
+ "id": "005c2502034d4f12",
+ "amount": 1,
+ "secret": "z+zyxAVLRqN9lEjxuNPSyRJzEstbl69Jc1vtimvtkPg=",
+ "C": "0241d98a8197ef238a192d47edf191a9de78b657308937b4f7dd0aa53beae72c46"
+ }
+ ]
+ }),
+ "tags": [
+ [ "a", "37375: