@forgesworn/moneyer 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,187 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1] - 2026-08-22
4
+
5
+ - `moneyer --dev` settles its invoices a moment after issuing them rather
6
+ than at the instant of issuance. Settling immediately made the mint
7
+ report an invoice nobody had paid as already settled, which on the wire
8
+ is indistinguishable from a mint handing out a note before it has been
9
+ paid for - the conformance grader failed it on exactly that, and was
10
+ right to. A dev mint should behave like a fast payer, not one that pays
11
+ before being asked. `autoSettleAfterMs` sets the delay; it defaults to
12
+ 1.5 seconds, which nobody developing against a local mint notices.
13
+ A freshly started `--dev` mint now grades 24 passed, 0 failed.
14
+
15
+ ## [0.2.0] - 2026-08-22
16
+
17
+ While LUD-25 is a draft, a `0.x` minor bump may be breaking; this one is
18
+ additive on the wire apart from the node-capacity rename below.
19
+
20
+ - The test suite has a 30 second timeout rather than vitest's 5 second
21
+ default. Nearly every test here starts an HTTP server, opens a database
22
+ and does real curve and KDF work; 5 seconds is a unit test's budget, and
23
+ on a loaded machine the slower cases crossed it while passing perfectly
24
+ well. A gate that fails at random teaches people to bypass it.
25
+ - **`moneyer --dev` is a mint a wallet can actually use.** The fake
26
+ funding source settled nothing on its own: settlement was reachable only
27
+ through an in-process handle a test holds, so a wallet pointed at a
28
+ standalone `MONEYER_BACKEND=fake` mint asked for an invoice, nothing ever
29
+ paid it, no note was ever minted, and every flow needing a note - split,
30
+ merge, melt, send - dead-ended behind an empty wallet while the mint
31
+ looked healthy throughout. `--dev` now treats every invoice it issues as
32
+ paid the moment it is issued, so minting, splitting and melting all work
33
+ locally against a wallet. It can only be set on the fake backend, which
34
+ moves no money, and the startup banner says plainly that the notes are
35
+ worth nothing. `MONEYER_FAKE_AUTOSETTLE=true` sets it explicitly for a
36
+ compose file that cannot pass a flag.
37
+ - The mint can announce itself. With `MONEYER_ANNOUNCE=true` and the Nostr
38
+ identity zap-to-note already uses, it publishes its own discovery
39
+ document hourly as a parameterised replaceable event (kind 30078, `d`
40
+ tag `lnurlcash-mint`), alongside the liabilities snapshot. Until now a
41
+ wallet could only learn of a mint by being told its address; this is the
42
+ half that has to exist before finding one means anything. The content is
43
+ the document exactly as the discovery endpoint serves it, so there is one
44
+ description of a mint and not two, plus a `sig` over the canonicalised
45
+ body made with the note signing key, so a holder can check the
46
+ announcement against the same key their notes verify against.
47
+ `verifyAnnouncement` is exported for that. Off unless the operator turns
48
+ it on: a mint that does not want to be listed says nothing. No new event
49
+ kind, and no recommendations or reviews; both are protocol decisions that
50
+ belong with the NIPs.
51
+ - A note melts to an invoice that states no amount. Such an invoice used
52
+ to be refused outright, which is a papercut for anyone paying one: for a
53
+ bearer note the amount was never in question, since the note's value is
54
+ the amount. The mint sends the whole-sat floor of the note's value, the
55
+ same figure it already accepts from a wallet that fills the amount in
56
+ itself, and keeps the sub-sat remainder as the same dust. A note worth
57
+ less than a single satoshi has nothing left once the floor applies and
58
+ is refused with `insufficient value`; it can still be melted by a wallet
59
+ that invoices its exact value. Everything else about the melt path is
60
+ untouched, including the pending and restore discipline.
61
+ - A wallet can name the note it is buying. It chooses the note's spend
62
+ secret itself, keeps it, and sends `h`, the sha256 of that secret, on
63
+ the pay callback; the mint credits the note at `h` when the invoice
64
+ settles. The invoice's payment preimage then buys nothing and is only a
65
+ payment proof, which is what it always should have been: a preimage is
66
+ known to the funding source, to every node that forwarded the payment,
67
+ and to anyone who polls LUD-21 `verify` with the payment hash written
68
+ inside the invoice. Naming the note leaves the buyer as the only party
69
+ who ever held the secret, and replaces "claim and rotate faster than
70
+ anybody else" with nothing to race for. A malformed `h` is refused
71
+ before an invoice is issued, so a wallet never pays for a quote the
72
+ mint would reject; an `h` that already names a note or an invoice is
73
+ refused with `Invalid or already spent k1.`, the same oracle-free
74
+ sentence a colliding output gets on the withdraw callback. The reply
75
+ carries `mintToHash: true` when the binding was made, and the payRequest
76
+ and the discovery document advertise `mintToHash: true` so a wallet
77
+ knows before it asks. Claiming needs no `verify` poll: the wallet asks
78
+ `/w?k1=<its own secret>` directly. Entirely optional and additive: a
79
+ wallet that sends no `h` gets exactly today's behaviour, and no existing
80
+ wallet or service breaks. The draft itself does need one additive
81
+ amendment, because it says a `SERVICE` MUST accept `k1=P` and a bound
82
+ mint deliberately does not; that is proposed separately. Wallets are urged to persist the secret before
83
+ requesting the invoice, which is the one thing that could make this
84
+ worse than what it replaces.
85
+ - A live note's informational GET now carries `payLink`, pointing at this
86
+ mint's payRequest, which is the counterpart of the `withdrawLink` a
87
+ payRequest already advertises. It is the route home for a holder who has
88
+ nothing but a note: from it a wallet reaches the discovery document, and
89
+ so the mint's terms and its retired signing keys. Without it a wallet
90
+ that only ever received notes cannot tell an announced key rotation from
91
+ a substituted key. Optional and additive; unknown and spent notes still
92
+ say nothing about the mint beyond the refusal.
93
+ - Both database connections now wait up to five seconds for a lock instead
94
+ of giving up at once. `node:sqlite` opens with no busy timeout, so a
95
+ second writer met `database is locked` the moment the first one held it.
96
+ The operator CLI is that second writer while the mint is running, and the
97
+ times you reach for `moneyer admin reconcile` are the busy ones. Nothing
98
+ was ever at risk of corruption; the command simply failed when it was
99
+ least convenient.
100
+ - The discovery endpoint carries the human layer: `name`, `description`,
101
+ `contact` (`nostr` as an npub, `email`, `url`), `tosUrl`, `motd`,
102
+ `fees`, `version` and `previousPubkeys`. Every one is optional and an
103
+ unset one is absent rather than empty. New environment variables:
104
+ `MONEYER_NAME`, `MONEYER_CONTACT_NOSTR`, `MONEYER_CONTACT_EMAIL`,
105
+ `MONEYER_CONTACT_URL`, `MONEYER_TOS_URL`, `MONEYER_MOTD`.
106
+ - **Wire-name change**: node capacity now goes out as `nodeCapacity`, the
107
+ name the reference mint, the conformance mock and `lnurlcash-kit` all
108
+ use. `nodeCapacityMsat`, which was moneyer's alone, is emitted alongside
109
+ it for this one release and then removed. Both are milli-satoshis.
110
+ - The mint's own site and the fallback landing page show the message of
111
+ the day, the operator's contact and the terms link, and read capacity
112
+ under either name.
113
+ - `GET /stats` states what the mint owes and what its funding node holds:
114
+ outstanding liabilities and note count, melts in flight and the age of
115
+ the oldest, the node's local balance, and the coverage ratio between
116
+ the two to four decimal places. Cached 30 seconds, never per-note,
117
+ public by design. `MONEYER_STATS=false` switches it off and
118
+ `MONEYER_STATS_RATIO_ONLY=true` publishes the ratio alone. Both the
119
+ mint's site and the fallback landing page carry a coverage row.
120
+ - `MONEYER_STATS_PUBLISH=true` publishes an hourly signed snapshot of
121
+ those figures to Nostr (kind 30078, `d` tag `lnurlcash-liabilities`),
122
+ signed with the note signing key so anyone can check the history
123
+ against the mint's advertised pubkey. `scripts/verify-stats.mjs` does
124
+ exactly that, and `verifyStatsSnapshot` is exported for wallets.
125
+ - The lnd and cln backends report the node's local channel balance;
126
+ the fake one reports a configurable balance, one bitcoin by default.
127
+ - **Self-service lightning addresses.** With `MONEYER_NAME_PRICE_MSAT`
128
+ set, anyone with an npub can claim `name@<host>` by posting to
129
+ `/names` with a NIP-98 Authorization and a note of this mint. The key
130
+ that signs the request owns the name; no other identity is accepted.
131
+ The note is burned and the name recorded in one transaction, so
132
+ nothing is ever paid for a name somebody else got first. Unset means
133
+ registration is closed; `0` means free, three names per pubkey.
134
+ Registered and operator-configured names live in one table and are
135
+ served by one lookup, and `GET /.well-known/nostr.json?name=` resolves
136
+ them over NIP-05 as well, one name at a time. Discovery advertises
137
+ `namePriceMsat` while registration is open.
138
+ - The kind 2525 rumor for a zap-funded note carries the zap request in a
139
+ `description` tag - the same content the kind 9735 receipt carries - so
140
+ a wallet can show who zapped and what they wrote without fetching the
141
+ receipt. Readers take tags by name, so an older one does not notice.
142
+ - `MONEYER_ZAP_NAMES` is now optional: a mint that opens registration can
143
+ start with no names of its own. `MONEYER_NOSTR_KEY` and
144
+ `MONEYER_NOSTR_RELAYS` still go together.
145
+ - `moneyer admin names` gains `add <name> <npub>` and `rm <name>`, and
146
+ `list` shows configured names the running mint has not loaded yet.
147
+ - **A retried rotate, split or merge is answered instead of refused.**
148
+ These are GETs, and transports retry GETs on their own: the retry
149
+ arrives byte-identical after the inputs are burned, and the old answer
150
+ - `Invalid or already spent k1.` - told the wallet to drop the only
151
+ copy of a secret the mint really had minted a note against. The mint
152
+ now records which request minted which outputs, and replays the same
153
+ reply: same signatures, nothing burned, nothing minted, no balance
154
+ moved. A request counts as the same request when it names the same
155
+ input notes and asks for the same `h`, `h2` and `amount`; input order
156
+ does not matter. Anything else naming a burned note is still refused
157
+ with the same reason string, so no oracle appears, and the melt path is
158
+ untouched. moneyer's own behaviour: the draft says nothing about
159
+ retries yet.
160
+ - `moneyer admin <command>`: the operator surface. `status`, `notes`,
161
+ `note`, `melts`, `reconcile`, `sweep`, `snapshot`, `names list`,
162
+ `keys rotate` and `verify-note`, all reading the same `MONEYER_*`
163
+ environment the mint does, and all opening the database read-only
164
+ unless the command mutates. `snapshot` uses `VACUUM INTO`, so it needs
165
+ no sqlite3 binary and is safe against a live mint; `keys rotate`
166
+ generates a key and prints the two environment lines without touching
167
+ anything.
168
+ - `MONEYER_METRICS=true` serves `GET /metrics` in the OpenMetrics text
169
+ format. Off by default and never authenticated by the app: restrict the
170
+ path at the reverse proxy. The README's Operating section names the
171
+ three alerts worth having.
172
+ - A "What the mint knows" section in the README, on the mint's own site
173
+ and on the fallback landing page, in the same words: what a LUD-25 mint
174
+ can see, what it cannot, why the wallet-side mitigations are weak, and
175
+ why the design was chosen anyway. Blindness is the one ecash property
176
+ this cannot offer, and a reader should not have to infer that.
177
+ - `MONEYER_PREVIOUS_SIGNING_PUBKEYS` lists the compressed pubkeys this
178
+ mint signed notes under before, published as `previousPubkeys` on
179
+ discovery. Rotating the signing key no longer invalidates every
180
+ outstanding note's signature or trips a pinned wallet's mismatch
181
+ check. Pubkeys only, validated as points on the curve at startup: the
182
+ old private keys are not needed to verify and should not stay on the
183
+ server. The runbook is in the README.
184
+
3
185
  ## [0.1.2] - 2026-08-21
4
186
 
5
187
  - `MONEYER_ROUND_FEE_TO_SAT` ceilings the mint fee to a whole sat, as