8000 GitHub - forgesworn/moneyer: An LNURLcash (LUD-25) mint - strikes Lightning bearer notes. Independent implementation: cln/lnd funding sources, SQLite, conformance-graded. · GitHub
[go: up one dir, main page]

Skip to content
forgeswornPublic

About

An LNURLcash (LUD-25) mint - strikes Lightning bearer notes. Independent implementation: cln/lnd funding sources, SQLite, conformance-graded.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

moneyer

An LNURLcash (LUD-25) mint. A moneyer was 8BD0 the mediaeval craftsman licensed to strike coins; this one strikes Lightning bearer notes.

Needs: Node.js 24+, self-hosted with SQLite and a Core Lightning or LND node reachable over REST. Needs Lightning. Nostr only for the optional zap-to-note feature.

moneyer is an independent implementation of the LUD-25 draft: paying an invoice it issues mints a bearer note, and a note's holder can rotate, split, merge and melt it against the withdraw callback. When a wallet buys a note, its spend secret is chosen by the buyer, before the invoice exists, and named to the mint only as a hash - so the mint never holds it, and neither does any node that forwards the payment. The exception is zap-to-note, where the mint creates the secret itself and knows it until the recipient rotates the note (see Zap-to-note), unless the name has a LUD-26 share, a cx1, when payments go to the holder's own keys. It passes the full lnurlcash-conformance grader, including the spending checks, and the grader runs in this repo's own test suite.

Reference stack, by dni (MIT): the LUD-25 draft, lnurl-mint, lnurl-wallet. moneyer shares no code with them; where their behaviour encodes a safety lesson, that behaviour is kept deliberately and tested.

What it is

  • TypeScript, ESM, Node 24+. node:http and node:sqlite; no web framework, no ORM.
  • Funding sources: cln (clnrest) and lnd (REST). Both accept a caller-supplied invoice preimage, so the mint knows the payment hash before the invoice exists and can refuse an invoice that does not commit to it. That is a nicety, not a requirement: a note is keyed by the buyer's comment commitment, which the funding source never sees, so a node that mints its own preimages (phoenixd, NIP-47 make_invoice) can back a mint too - it just gets the after-the-fact checks instead. A backend declares which it is with acceptsInvoicePreimage. A fake backend exists for development and tests; the moneyer CLI refuses to run it outside --dev.
  • Notes are stored by their taproot output key Q, as LUD-25 now defines every note - the store never holds a spend. The buyer names the note they are buying with a mandatory LUD-12 comment, so the spend is theirs alone from the start (zap-to-note, where the mint creates the note, is the exception).
  • Signs every note it mints with its own mint key (secp256k1, the standard Lightning Signed Message construction) for LUD-25 offline verification.
  • The melt discipline: reserve the note, then give the payment up to two seconds. A payment the funding source confirms never left (no route, say) is answered ERROR with its reason and the note is outstanding again; anything else is answered OK and finishes in the background. Burn only on confirmed payment, restore only on confirmed non-payment, and park everything else as pending for reconciliation - which also runs at startup, so a crash mid-melt never guesses. An invoice whose melt was restored may be melted into again, from that note or another; one that paid or is still unresolved is refused.

Run

npm install @forgesworn/moneyer
# development: fake funding source (invoices settle themselves, nothing can
# pay them), in-memory store, ephemeral signing key, a funded note printed
npx moneyer --dev

# production shape
MONEYER_BACKEND=cln \
MONEYER_BACKEND_URL=https://127.0.0.1:3010 \
MONEYER_BACKEND_RUNE=... \
MONEYER_SIGNING_KEY=<32 bytes hex> \
MONEYER_PUBLIC_ORIGIN=https://mint.example \
MONEYER_DB=/var/lib/moneyer/mint.sqlite \
npx moneyer

Or build from source, where the entry point is dist/cli.js:

git clone https://github.com/forgesworn/moneyer
cd moneyer && npm install && npm run build && npm run web:build
node dist/cli.js --dev

The mint is then payable at mint@mint.example (and the bare-domain _ alias).

Before you point one at mainnet, read Before you run this in the deployment guide. A mint holds other people's bitcoin as bearer liabilities, and it is the custody rather than the code that a regulator has a view on. In the UK that view is specific: the Money Laundering Regulations 2017 gate the custody of cryptoassets, by way of business, on FCA registration; the financial promotion rules gate how a mint may be marketed; sanctions law binds regardless. DEPLOY.md walks through all three. Two things carry most of the weight on the payments side: an evaluation mint should be configured as one (a fee kept at or below cost recovery rather than zeroed, no priced names, a small cap, a MOTD that says so - or better, a test network), and no mint should ever touch fiat. moneyer is millisatoshis throughout, deliberately, and that boundary is what keeps a mint clear of the payments and e-money regimes.

Quickstart: a wallet's flow

Start a development mint (npx moneyer --dev, above), then walk one note through its life with nothing but fetch, plus fakeBolt11 for the melt's dev-only invoice. The callbacks answer a refusal with an HTTP 200 and {"status": "ERROR", "reason": "..."}, so a wallet checks status, not the HTTP code.

The --dev mint has no Lightning node behind it. Its fake funding source issues invoices that no wallet can pay and settles each one itself about 1.5 seconds after issuing it, and it "pays" a melt without sending anything. The comments below say where a real mint (cln or lnd) differs.

import {createHash, randomBytes} from 'node:crypto'
import {fakeBolt11} from '@forgesworn/moneyer' // step 6 only, and only against --dev

const mint = 'http://127.0.0.1:3737' // or your mint's origin
const get = async (url: string) => (await fetch(url)).json()
const sha256 = (hex: string) => createHash('sha256').update(Buffer.from(hex, 'hex')).digest('hex')

// 1. Discover. The payRequest carries callback, minSendable and maxSendable
//    (msat) and commentAllowed: 64.
const pay = await get(`${mint}/.well-known/lnurlp/mint`)

// 2. Choose the note's spend secret and persist it durably BEFORE asking for
//    an invoice. The mint is only ever told its hash.
const secret = randomBytes(32).toString('hex') // this is the k1: holding it is holding the note
const h = sha256(secret)

// 3. Quote. The mandatory LUD-12 comment names the note to be minted.
const quote = await get(`${pay.callback}?${new URLSearchParams({amount: '21000', comment: h})}`)
// quote.pr is a BOLT-11 invoice for 21000 msat. On a real mint, pay it from
// any Lightning wallet; on --dev nothing can pay it and it settles itself.
// quote.verify is the LUD-21 URL to poll for settlement.

// 4. Claim. Until the invoice settles, the committed note reports zero.
while (!(await get(quote.verify)).settled) await new Promise(resolve => setTimeout(resolve, 500))
const note = await get(`${mint}/w?p=${h}`)
// note.maxWithdrawable is the note's value in msat, note.lnurlcash.c its
// certificate, and note.callback the /w/cb URL used below.

// 5. Rotate on receipt. Persist the new secret before sending the swap.
const next = randomBytes(32).toString('hex')
await fetch(note.callback, {
  method: 'POST',
  body: new URLSearchParams({k1: secret, p: sha256(next)})
}).then(res => res.json())
// {status: 'OK', c: ['<cs1>']}

// 6. Melt: pay the note out to a BOLT-11 invoice with k1 and pr.
// The invoice is for the note's value (21000 msat) or states no amount. On a
// real mint it comes from the wallet you are paying out to. On --dev it only
// has to decode, and nothing is sent: `fakeBolt11` (see As a library) makes
// one. A placeholder such as 'lnbc...' is refused as 'Invalid invoice.' The
// payment hash must be fresh: one an earlier melt used, that the node has
// paid, or that this mint issued itself is refused, so each melt needs a new
// random hash.
const invoice = fakeBolt11({
  amountMsat: note.maxWithdrawable,
  paymentHashHex: randomBytes(32).toString('hex')
})
const melt = await get(`${note.callback}?${new URLSearchParams({k1: next, pr: invoice})}`)
// {status: 'OK', pr, verify}. OK means in flight, not paid: poll melt.verify
// (LUD-21) for {settled: true}.
operation method and parameters answer
melt GET k1=<spend>&pr=<bolt11> {status, pr, verify}. A fixed invoice may ask for any positive amount between the whole-sat floor and the note's full value. An amountless invoice receives the full value.
rotate POST k1=<spend>&p=<new note> {status, c: [certificate]}
split POST k1=<spend>&p=<note for amount>&amount=<msat>&p=<change note> {status, c: [certificate, changeCertificate]}
merge POST k1=<spend>&k1=<spend>...&p=<new note> {status, c: [certificate]}

A k1 is a bearer secret, ck1 or cw1. Each form-encoded p names a wallet-generated output by bearer hash or cp1. The last output receives all remaining value and must receive at least 1000 msat. Swaps are free.

Configuration

Environment only. Every variable is MONEYER_*; anything unset takes the default, and a variable set to an empty string counts as unset.

variable default what it does
MONEYER_HOST 127.0.0.1 listen address
MONEYER_PORT 3737 listen port
MONEYER_PUBLIC_ORIGIN derived from Host the origin wallets are told to call back on. Required behind a reverse proxy, and required for zap-to-note
MONEYER_ONION_URL this mint as a Tor hidden service, e.g. http://<v3>.onion. A request arriving on that host gets its URLs built from it (see below)
MONEYER_SCRIPT_VERIFIER a command that judges script-path spends moneyer cannot evaluate itself, e.g. python3 /opt/moneyer/kernel-verifier.py (see DEPLOY.md). Unset, such spends are refused and their notes wait
MONEYER_USERNAME mint the local part of the mint's own lightning address
MONEYER_DESCRIPTION an LNURLcash note what a note is called on the wire (defaultDescription, and description on discovery)
MONEYER_DB moneyer.sqlite SQLite path; :memory: allowed
MONEYER_BACKEND fake cln, lnd, or fake. The moneyer CLI refuses fake outside --dev, so set this for anything else; the library does not refuse it (see As a library)
MONEYER_BACKEND_URL the funding source's REST endpoint
MONEYER_BACKEND_RUNE cln authentication
MONEYER_BACKEND_MACAROON lnd authentication, hex
MONEYER_SIGNING_KEY required Persistent 32-byte hex note-signing key. The service refuses to start without it; use moneyer admin keys rotate to generate one. moneyer --dev is the one exemption: it generates an ephemeral key that is lost on exit, unless this variable is set
MONEYER_PREVIOUS_SIGNING_PUBKEYS compressed pubkeys this mint signed under before, comma separated (see below)
MONEYER_BASE_FEE_MSAT 0 flat mint fee
MONEYER_FEE_PPM 0 proportional mint fee, parts per million
MONEYER_MIN_SENDABLE_MSAT 1000 smallest payment the mint advertises
MONEYER_MAX_SENDABLE_MSAT 100000000 largest payment the mint advertises
MONEYER_MIN_MINT_MSAT 1000 dust floor: the smallest note the mint will strike
MONEYER_MAX_K1S 21 most notes one callback may name
MONEYER_VERIFY true issue LUD-21 verification URLs for mint and zap quotes. Melt verification is always available.
MONEYER_WALLET_URL a companion web wallet the mint's site links notes into
MONEYER_SUNSET false wind down: refuse anything that grows liabilities, keep every way out open
MONEYER_SUNSET_DATE the day this mint plans to close, ISO-8601 (2026-12-31). Published so a wallet can warn its holder while spending is still possible
MONEYER_STATS true the /stats endpoint. Off means 404
MONEYER_STATS_RATIO_ONLY false publish the coverage ratio alone, without the size of the book
MONEYER_STATS_PUBLISH false publish a signed hourly snapshot of /stats to Nostr
MONEYER_ANNOUNCE false announce this mint on Nostr, hourly, so a wallet can find it (see below)
MONEYER_METRICS false the /metrics endpoint, in the OpenMetrics text format
MONEYER_NAME_PRICE_MSAT what a self-service lightning address costs. Unset means registration is closed; 0 means free. Needs the Nostr identity below
MONEYER_NOSTR_KEY the mint's own Nostr identity, 32 bytes of hex: seals zap gift wraps and signs zap receipts, and is the identity behind MONEYER_STATS_PUBLISH and MONEYER_ANNOUNCE. Set together with MONEYER_NOSTR_RELAYS; zap-to-note also needs MONEYER_PUBLIC_ORIGIN
MONEYER_NOSTR_RELAYS comma-separated ws:// or wss:// relay URLs: where receipts and snapshots go, and where a recipient's inbox list is looked for. Required with MONEYER_NOSTR_KEY, and the reverse
MONEYER_ZAP_NAMES name=npub1... or name=<hex pubkey>, comma separated: lightning addresses on this host that pay out as notes gift-wrapped to that pubkey. Optional, because a mint can open registration and start with none. A name must not be the mint username or _ (see Zap-to-note)

Who runs this mint

Optional, all of it, and unset means the field is simply absent from the discovery endpoint rather than present and empty. This is the human layer a holder wants before trusting a mint with sats.

variable what it does
MONEYER_NAME the mint's name, shown on its own site and published as name
MONEYER_CONTACT_NOSTR an npub or hex pubkey to reach the operator on; published as an npub
MONEYER_CONTACT_EMAIL an email address to reach the operator on
MONEYER_CONTACT_URL a contact page
MONEYER_TOS_URL the terms a holder is agreeing to
MONEYER_MOTD a message of the day, at most 280 characters: maintenance, a sunset, a fee change. It is how an operator talks to holders without a mailing list they never signed up to

The discovery endpoint also publishes fees (the structured twin of the payRequest metadata's fee prose), version, and previousPubkeys.

The website

GET / se 10000 rves the mint's own site (web/, vite + anime.js, built by npm run web:build into memory-served static files). It is a wallet-grade LNURLcash client in its own right, driven entirely by @lnurlcash/kit against the same endpoints every wallet uses:

  • Mint a note in the browser: amount in, fee grossed up and shown before the invoice exists, invoice QR (tap opens a wallet), LUD-21 polling with a countdown, and on settlement the note is claimed and immediately rotated - the preimage any invoice-observer could poll out of verify is dead before the note is shown. The settlement receipt is verified against the mint's advertised key in front of the user, and the QR arrives under scratch-off silver foil, rubbed away like a scratch card.
  • Check a note: live value, spent/unknown/pending classified in plain words, and offline verification of a cp1 note's certificate.
  • MONEYER_WALLET_URL (optional) links minted notes straight into a companion web wallet's #/claim route.

Without a web build the server falls back to a self-contained, zero-script landing page, so an npm-installed mint still has a face.

As a library

createMoneyer(config, deps?) starts the same server the moneyer binary does and resolves to a running Moneyer. configFromEnv() reads the MONEYER_* variables, so with the production variables above set, this is the whole program:

import {createMoneyer, configFromEnv} from '@forgesworn/moneyer'

const mint = await createMoneyer(configFromEnv())
console.log(mint.url) // http://127.0.0.1:3737, the origin with the port included
// ...
await mint.close()

With an empty environment that throws, because MONEYER_SIGNING_KEY (the signingKey field) is required. The library has no --dev flag and does not refuse the fake funding source, which the CLI does outside --dev. The equivalent of --dev is a throwaway key, an in-memory store and a fake backend that settles its own invoices:

import {randomBytes} from 'node:crypto'
import {createMoneyer, configFromEnv, createFakeBackend} from '@forgesworn/moneyer'

const mint = await createMoneyer(
  configFromEnv({MONEYER_SIGNING_KEY: randomBytes(32).toString('hex'), MONEYER_DB: ':memory:'}),
  {backend: createFakeBackend({autoSettle: true})}
)
console.log(mint.url)
await mint.close()

A Moneyer is {url, port, config, store, backend, signer, zap, reconcile, stats, publishStats, publishAnnouncement, close}: zap is null unless zap-to-note is configured, stats() is the snapshot /stats serves, and publishStats() and publishAnnouncement() force the hourly Nostr passes.

MoneyerDeps

The optional second argument. Every field is optional.

field what it does
backend: LightningBackend the funding source; omitted, one is built from config.backend
store: NoteStore the note store; omitted, new NoteStore(config.dbPath)
log: (message: string) => void where operational messages go; omitted, nowhere
scriptVerifier: ScriptVerifier judges script-path spends moneyer cannot evaluate; omitted, one is run from config.scriptVerifier if set, otherwise such spends are refused
webAssets: WebAssets | null the built website served at GET /; omitted, web/dist is loaded from disk; null serves the self-contained landing page
nostr: NostrTransport relay access for zap-to-note; omitted, a real relay pool
confirmDelaysMs: number[] backoff between confirmations of an unclear melt payment
meltAnswerWindowMs: number how long a melt callback waits for the payment's outcome before answering OK (2000 by default)
zapPollMs: number how often settled zap invoices are looked for
statsPublishMs: number how often a signed liabilities snapshot is published
invoiceStreamRetryMs: number first wait before reconnecting a dropped invoice stream, doubling to a minute

The last five exist so tests can shrink them. WebAssets and NostrTransport are not exported from the package.

Library API

Everything exported from src/index.ts. Amounts are millisatoshis, and a Q is a note's taproot output key.

export what it is
createMoneyer(config: MoneyerConfig, deps?: MoneyerDeps): Promise<Moneyer> start a mint; throws without config.signingKey
configFromEnv(env?: NodeJS.ProcessEnv): MoneyerConfig read MONEYER_* (default process.env); throws on a value it cannot honour
DEFAULTS the default host, port, username, description, sendable limits, minMintMsat, dbPath, verify, maxK1s and the other flags
MoneyerConfig, BackendConfig the config object, its fields mirroring the variables (signingKey, dbPath, publicOrigin, mintFee, ...); BackendConfig is {kind: 'fake', autoSettle?, autoSettleAfterMs?} | {kind: 'cln', url, rune} | {kind: 'lnd', url, macaroon}
NoteStore new NoteStore(path: string, options?: {readOnly?: boolean}): the SQLite store; notes by hex(Q), never a spend, pre-Q rows found through legacy_ids
NotePendingError, NoteUnavailableError, OutputCollisionError store errors for a note with a melt in flight, a note that is burned or was never minted, and an output id already in use
NoteRow, NoteState, MeltRow, MintInvoiceRow, Liabilities store row types; NoteState is 'outstanding' | 'pending' | 'burned'; Liabilities is {outstandingMsat, outstandingNotes, pendingMsat, pendingMelts, oldestPendingMeltAgeSecs}
createNoteSigner(privateKeyHex: string): NoteSigner {pubkey, sign(noteId: string, amountMsat: number): string}; sign returns r || s || recovery id as hex
noteIdSignatureDigest(noteId, amountMsat): Uint8Array the digest a note signature covers
signDigestRecoverable(digest: Uint8Array, privateKeyHex): string a recoverable signature in the LUD-25 wire layout
recoversToPubkey(digest: Uint8Array, signatureHex, pubkeyHex): boolean does the signature recover to that key
decodeSpend(k1: string): Spend | null a preimage, ck1 or cw1, with the Q it opens; nothing is checked against a note
decodeNote(value: string): string | null hex(Q) of a cp1 or a bearer note's 64-hex h
verifySpend(spend: Spend, context: {outputKey: Uint8Array, domains: string[], now: number, lockedAt: number, scriptVerifier?: ScriptVerifier}): Promise<SpendVerdict> does the spend open the note; now and lockedAt are Unix seconds
bearerNoteId(hHex: string): string, bearerNoteIdOfPreimage(k1Hex: string): string hex(Q) of the bearer note with hash h, or opened by that preimage
keyPathSighash(outputKey: Uint8Array, domain: string): Uint8Array what a ck1 signs
scriptPathSighash(outputKey: Uint8Array, domain: string, leafScript: Uint8Array, locktime: number, sequence: number): Uint8Array what a signature inside a cw1 leaf signs
spendDomainOf(origin: string): string the bare lower-case hostname a spend is bound to
decodeShare(cx1: unknown): Share | null, shareOnFile(cx1: string | null): Share | null a LUD-26 share, or (on file only) a whole branch from before it; Share has cx1, legacy, xOnly, noteAt(index): string | null and proofKeys()
registrationMessage(action, domain, username, cx1?): string, proofVerifies({action, domains, username, cx1?, keys, sig, legacy?}): boolean Original NIP-98 address proof message and BIP-340 verification for LUD-26 or legacy proofs
deriveNotePubkey(branchPubkeyXOnly: Uint8Array, chainCode: Uint8Array, purpose: number, index: number): Uint8Array a pre-LUD-26 whole branch's note key, for names registered before it
NOTE_PURPOSE_WALLET (0), NOTE_PURPOSE_CHANGE (1), NOTE_PURPOSE_LIGHTNING_ADDRESS (2) that branch's purposes
Spend, ScriptSpend, SpendVerdict, ScriptVerifier SpendVerdict is {ok: true} | {ok: false, reason, specific}; ScriptVerifier is ({outputKey, domain, spend, now, lockedAt}) => Promise<string | null>, resolving to the refusal reason or null
createKernelVerifier(options: {command: string[], timeoutMs?: number, log?}): KernelVerifier a ScriptVerifier that runs a command speaking the line protocol of scripts/kernel-verifier.py, with a close()
buildStats(args: {liabilities, localBalanceMsat?, reconciledAt?, at?, ratioOnly?}): MintStats the /stats document; liabilities is store.liabilities()
canonicalJson(value: Record<string, number | string>): string the RFC 8785 body that is signed
statsDigest(stats): Uint8Array, signStats(stats, privateKeyHex): string, verifyStatsSignature(stats, signatureHex, mintPubkeyHex): boolean sign and check the stats
statsSnapshotContent(stats, privateKeyHex): string, verifyStatsSnapshot(content, mintPubkeyHex): {valid, stats} the published snapshot: the stats JSON plus sig; stats is null for unparseable content, so check valid first
STATS_KIND (30078), STATS_D_TAG (lnurlcash-liabilities), MintStats the snapshot's event kind and d tag, and the stats type
announcementContent(document, privateKeyHex?): string, signAnnouncement(document, privateKeyHex): string, announcementDigest(document): Uint8Array, canonicalise(value: unknown): string build and sign a mint announcement
verifyAnnouncement(content: string, mintPubkeyHex: string): {valid: boolean, document: MintAddressDocument | null} check an announcement against the note-signing key
ANNOUNCE_KIND (30078), ANNOUNCE_D_TAG (lnurlcash-mint), ANNOUNCE_MESSAGE_PREFIX, MintAddressDocument announcement constants and type
LightningBackend, NodeInfo, PaymentOutcome the funding-source interface (name, acceptsInvoicePreimage, createInvoice, payInvoice, isPaymentComplete, isInvoiceSettled, invoicePreimage, paymentPreimage, optional nodeInfo, watchSettledInvoices, close) and its result types
PaymentFailedError, PaymentPendingError, PaymentAlreadyKnownError a clean terminal failure, a payment with no answer yet, and a payment on a shared node this call did not create
createClnBackend(config: {url: string, rune: string}): LightningBackend clnrest funding source
createLndBackend(config: {url: string, macaroon: string}): LightningBackend lnd REST funding source
createFakeBackend(options?: {autoSettle?, nodeChoosesPreimage?, autoSettleAfterMs?, streamsSettles?}): FakeBackend in-process funding source for development and tests, with .control hooks; FakePayMode is its payment-mode type
fakeBolt11(args: {amountMsat?: number, paymentHashHex: string, memo?: string, timestamp?: number}): string a decodable, unpayable invoice; omit amountMsat for an amountless one
runMelt(job: MeltJob, deps: MeltDeps): Promise<{kind: 'paid'} | {kind: 'restored', reason} | {kind: 'unresolved'}> the melt discipline: burn only on confirmed payment, restore only on confirmed non-payment; MeltJob is {paymentHash, noteId, pr, amountMsat, payAmountMsat?}, MeltDeps is {store, backend, feeLimitMsat(amountMsat), confirmDelaysMs?, log?}
reconcilePendingMelts(store, backend, inFlight: ReadonlySet<string>, log?): Promise<void> resolve melts an earlier process left pending
runAdmin(argv: string[], deps?: AdminDeps): Promise<number>, adminHelp(): string the moneyer admin commands, returning the exit code, and their help text

Rotating the signing key

moneyer signs notes with its own key rather than the funding node's, so the node can be swapped without touching a single outstanding note. The signing key itself is the harder one: rotate it naively and every note already out there stops verifying at once, and every wallet that pinned the old key refuses the mint on its next contact.

So the old pubkeys stay published. previousPubkeys on the discovery endpoint lists the keys this mint has signed under before, and a wallet that finds its pin in that list treats the change as a rotation rather than an impostor. The trust argument is TOFU's own: whoever controls the host controls the pin either way, and the history only stops a legitimate rotation from looking like an attack.

To rotate:

  1. Generate a new key: openssl rand -hex 32.
  2. Set MONEYER_SIGNING_KEY to the new key, and add the old public key to MONEYER_PREVIOUS_SIGNING_PUBKEYS (compressed, 33 bytes of hex, comma separated, oldest last). The old private key is not wanted here and should not stay on the server: verifying an old note needs only the pubkey.
  3. Restart. Notes signed under the old key keep verifying against it; every note minted or mutated from now on is signed under the new one, so a holder who rotates their note re-signs it under the new key for free.
  4. Tell holders through MONEYER_MOTD.

Both variables are validated at startup: an entry that is not a compressed point on the curve, or that repeats the current key, stops the mint rather than quietly publishing a key that verifies nothing.

Transparency: what the mint owes

LNURLcash notes are not blinded, so a mint can state its liabilities exactly. No epochs, no blinded sums, no ceremony: the mint knows every note it has issued and what each is worth, and it can add them up.

curl -s https://mint.example/stats | jq
{
  "at": 1755800000000,
  "outstandingMsat": 48120000,
  "outstandingNotes": 12,
  "pendingMsat": 0,
  "pendingMelts": 0,
  "oldestPendingMeltAgeSecs": 0,
  "localBalanceMsat": 92400000,
  "coverage": 1.9202,
  "reconciledAt": 1755799800000
}

coverage is the funding node's outbound balance over the mint's outstanding liabilities, to four decimal places. Under 1 means the node could not pay every note out today; that is the operator's business to show, not the endpoint's to hide. A mint with nothing outstanding has no coverage figure at all, because "infinitely covered" is not a claim worth making, and a funding source that will not report its balance leaves both localBalanceMsat and coverage out rather than have them guessed.

The figures are cached for 30 seconds, are never per-note, and appear as one row on the mint's own site and its fallback landing page. The endpoint is public by design. MONEYER_STATS=false switches it off; MONEYER_STATS_RATIO_ONLY=true publishes the ratio without the size of the book.

The discovery document carries the same number as outstandingNotesMsat, so a wallet reading a mint address learns what it owes without a second request. Both switches govern it: an operator who has turned /stats off, or down to the ratio, has already said not to publish the size of the book, and a second endpoint doing it anyway would make those switches a lie.

Signed snapshots

With MONEYER_STATS_PUBLISH=true, and the Nostr identity that zap-to-note uses, the mint publishes an hourly snapshot as a parameterised replaceable event (kind 30078, d tag lnurlcash-liabilities). Its content is the /stats JSON plus a sig over the canonicalised (RFC 8785) body, made with the note signing key - the key a holder already checks their own notes against, so the history adds nothing new to trust.

# installed from npm
node node_modules/@forgesworn/moneyer/scripts/verify-stats.mjs <mintPubkey> snapshot.json

# from a source checkout, after npm run build
node scripts/verify-stats.mjs <mintPubkey> snapshot.json

snapshot.json holds the event's content, and the script reads stdin when no file is named. It needs the built dist/, which the package ships.

Announcing the mint

A wallet only ever learns of a mint by being told its address. There is no way to find one, and nothing that might follow from finding one, a list or a recommendation, can exist until that first step does.

With MONEYER_ANNOUNCE=true, and the same Nostr identity zap-to-note uses, the mint announces itself on the same hourly pass as the snapshot: kind 30078 again, d tag lnurlcash-mint. The content is this mint's own discovery document, exactly as /.well-known/lnurlw/<user> serves it, so there is one description of a mint rather than two that drift apart. It carries a sig over the canonicalised (RFC 8785) document made with the note signing key, so a holder can check that the mint announcing itself is the mint their notes verify against, whoever the Nostr identity publishing it belongs to. verifyAnnouncement in this package does that check.

Off by default, deliberately. A mint that does not want to be listed says nothing, and turning it on is the operator saying otherwise. Announcing needs MONEYER_PUBLIC_ORIGIN, since an announcement made with a Host header nobody sent is an address nobody can call back on.

There is no recommendation or review here, and no new event kind. Both are protocol decisions that belong with the LNURLcash NIPs rather than with a single mint's implementation.

The mint fee

The mint publishes lnurlcash.fees on pay and withdraw responses. The fee is base_msat + floor(gross_msat * ppm / 1_000_000). The invoice reply quotes the exact value minted in lnurlcash.credit. MONEYER_ROUND_FEE_TO_SAT is a deprecated configuration option. All new quotes use millisatoshi-exact fees.

A fixed-value melt may pay the whole-sat floor through the full note value. The mint keeps any remainder, and an amountless invoice receives the full value.

Melting to an invoice with no amount

An invoice that states no amount leaves the sending side to decide, and for a bearer note there is nothing to decide: the note's value is the amount. moneyer melts a note to one for exactly that value, to the millisatoshi, so a note that is not a whole sat goes out whole too.

Nothing else about the melt changes. OK still means in flight, the note still burns only on confirmed payment and restores only on confirmed non-payment, and the routing budget is still sized against the note.

Name the note you are buying

Paying a mint invoice (a quote from /p/cb) always mints to a wallet-generated secret. The wallet chooses and persists that secret first, then sends its SHA-256 commitment in the mandatory LUD-12 comment. A zap invoice is the exception, covered under Zap-to-note:

GET /p/cb?amount=21000&comment=<64 hex>

The mint credits the note at that commitment when the invoice settles. The payment preimage then buys nothing: it is an ordinary payment proof, which is why verify goes on serving it. Nobody but the buyer ever knew the secret, so there is no race left to run, and no window in which holding the invoice is nearly holding the money.

On lnd and cln the mint watches the node's settled invoices (lnd's invoice subscription, cln's waitanyinvoice), so the note exists from the moment the invoice is paid, whether or not the wallet ever comes back. Each report is checked against the node before anything is credited, and the stream resumes from the last settle it handled after a drop or a restart. Without it, a paid invoice is credited when the wallet claims or polls verify, or at the latest when the expiry sweep finds it paid.

Every note is a taproot output key

LUD-25 makes every note a BIP-341 output key Q, written cp1<Q>, and that is what this mint stores, burns and certifies. The 64-hex secret above is the short form of the simplest kind, a bearer note: an OP_SHA256 <h> OP_EQUAL leaf under BIP-341's NUMS key, so its Q follows from h alone. Wherever a note is named (a comment, p, p1, p2), 64 hex is that h, and cp1<Q> names any note directly. Wherever one is spent (k1), it can be:

  • the 64-hex preimage of a bearer note;
  • ck1<Q || sig>, a key-path spend: a BIP-340 signature by Q over the sighash of LUD-25's canonical spend transaction, whose prevout commits to this mint's domain, so it cannot be replayed at another mint. Any of the mint's own hosts counts, clearnet or onion. The older ck1 shapes are still accepted, as the reference mint accepts them;
  • cw1<...>, a script-path spend: a leaf of Q's tree, its control block and the witness that satisfies it. A bearer note's full cw1 is the same note as its preimage. Leaf versions other than 0xc0 and OP_SUCCESSx leaves are refused, and time claims are checked against the mint's own clock: Unix times only, relative locks counted from when the note was credited. That is the mint asserting its clock, a custodial policy and not a consensus proof.

Bearer hashlock leaves are evaluated in process. LUD-25 has a mint accept any consensus-valid leaf, and moneyer is not a tapscript interpreter, so any other leaf goes to Bitcoin Core's own, the one the reference mint uses: set MONEYER_SCRIPT_VERIFIER to run scripts/kernel-verifier.py beside the mint (or pass a scriptVerifier to createMoneyer). Without one such a spend is refused with a reason and the note stays outstanding; a verifier that crashes, errors or stalls refuses too, and never accepts.

Every outstanding note carries a cs1 certificate over LNURLcash:<domain>:<amount_msat>:<hex(Q)>:<unix_time>. Lookups return it in lnurlcash.c. Swaps return an array of certificates in output order. A pending or burned note reports zero and carries no certificate. A verified spend of a pending note returns pending, and a burned spend returns already in use.

Moneyer's earlier mintToHash extension remains additive. A compatible wallet repeats the same commitment as h; it does not replace comment:

GET /p/cb?amount=21000&comment=<64 hex>&h=<same 64 hex>

The rules:

  • comment is mandatory and is exactly 64 hex characters, the SHA-256 of a 32-byte secret (or a cp1 key). A missing or malformed comment is refused before an invoice exists, with a mint quote must name its output with a LUD-12 comment carrying a cp1 key or hex(sha256(secret)).
  • When supplied, h has the same meaning h carries on the withdraw callback. Upper case is accepted and read as lower case, there too.
  • comment and h must match. A disagreement is refused (comment and h name different outputs) rather than guessing which output the wallet is watching.
  • A malformed h is refused (missing h) before the mint asks its funding source for anything, so a wallet is never left holding a quote the mint was always going to reject.
  • A comment (and so an h) that already names a note, an invoice, or a note another buyer has already bought is refused with already in use, the same reason a colliding output gets on the withdraw callback. Which table an id sits in is an oracle nobody is owed. Invalid or already spent k1. is for a k1 that opens nothing: unknown, already burned, or named twice in one request.
  • The callback's reply carries mintToHash: true when the invoice really was bound to h. A mint that did not implement the parameter would ignore it and answer without that field, so a wallet can tell the two apart before paying rather than by hunting for a note afterwards.
  • The payRequest and the discovery document both advertise mintToHash: true, so a wallet knows this mint takes the parameter before it asks rather than after it pays.
  • When signing and LUD-21 verification are enabled, the quote also carries mint: {h, amount}. This is the exact output, in the spelling the wallet named it (a bearer note's hex h, or its cp1), and the net millisatoshi value the invoice will mint; it never carries sig before settlement.
  • Once settled, /verify repeats the same h and amount and adds sig, the note's ordinary LUD-25 certificate: a cs1 over its Q. A sealed signer can verify that receipt against the pre-payment commitment and pinned mintPubkey, then confirm its staged note without exporting k1.
  • Claiming needs nothing else. GET /w?k1=<the secret> brings the note into existence as soon as the invoice has settled, with no verify poll and no preimage involved. LUD-21 remains useful settlement evidence.
  • Persist the secret before asking for the invoice. Paying and then losing the secret is the one way this is worse than the old arrangement, and writing it down first removes it entirely.

A comment-bound note is also derived-secret friendly: a wallet whose secrets come from its seed can restore a note it bought but never claimed, which a note whose secret was a preimage could never offer.

The proposed normative wire text, invalid cases and compatibility matrix are kept executable in lnurlcash-conformance.

Retrying a request

Persist a swap's output secrets before submitting it. If the response is lost, send the same swap again. Moneyer records the sorted set of input keys and ordered output keys and amounts, so a retry returns the original certificates without moving value again. Output and input equality is based on the decoded taproot output key.

A melt replay with the same note and invoice returns the original opaque verification URL while pending or settled. When verification reports a failure, look the note up to confirm its value is available again. An open mint quote can be retrieved by asking for the same amount and output key.

What the mint knows

This mint knows every note it has issued and what each is worth. It knows every rotate, split and merge, the links between them - which note became which, and when - and the network address the request came from. It knows the invoice a melt paid.

It does not know who holds a note between those operations. A note handed to someone else offline leaves no trace here until they rotate it, which is one reason a wallet rotates on receipt.

The wallet-side mitigations are weak, and worth naming as weak. A Tor or SOCKS proxy hides the address, not the links. Rotating at unpredictable times blurs the timing, not the graph. Nothing a holder does stops this mint seeing the chain of notes it struck.

The design was chosen anyway because it needs no new cryptography, any LUD-03 wallet can cash a note out, and verifying a note offline needs a signature and nothing else. The privacy story is trust the operator, and that is worth saying plainly.

Zap-to-note: a lightning address that pays out as a note

A Nostr zap is an ordinary LNURL-pay and carries no current-LUD-25 output commitment. Moneyer therefore serves zap names in the recipient direction. A zap to alice@<host> gets an invoice with a throwaway preimage; when it settles, the mint creates a note with a fresh secret, seals it in a NIP-59 gift wrap (a kind 2525 rumor, the shape heartwood-esp32 and notecase read) to alice's pubkey, leaves it on her NIP-17 inbox relays, and publishes the kind 9735 receipt so the zap shows up in her client like any other. A hardware wallet that catches up on its inbox when it powers on will find the note waiting.

Until alice rotates the note, the mint knows its secret. That is the position every freshly minted note is in, and it is why wallets rotate on receipt; notecase does it on heartwood collect. What is new is that the mint learns who was paid, which a lightning address always did.

MONEYER_PUBLIC_ORIGIN=https://mint.example      # required: settlement is on a timer
MONEYER_NOSTR_KEY=<32 bytes hex>                # the mint's own Nostr identity
MONEYER_NOSTR_RELAYS=wss://relay.example,wss://nos.lol
MONEYER_ZAP_NAMES="alice=npub1...,bob=<hex pubkey>"   # optional, see below

The key and the relays go together; the names are optional, because a mint can open registration and start with none of its own. A zap name's payRequest carries allowsNostr and the mint's nostrPubkey, and deliberately no withdrawLink. The receipt carries no preimage tag: it is optional in NIP-57, and here it would only invite someone to mistake it for the note. A zap name must not be the mint username or _. The kind 2525 rumor carries the zap request in a description tag, so a wallet can show who zapped and what they wrote without fetching the receipt.

Self-service: anyone with an npub can claim a name

Set MONEYER_NAME_PRICE_MSAT and the mint takes registrations. Unset means registration is closed and POST /names 404s; 0 means free, capped at three names per pubkey (rate limiting per address is the reverse proxy's job).

curl -X POST https://mint.example/names \
  -H "Authorization: Nostr <base64 kind 27235 event>" \
  -d '{"name":"donkey","note":"https://mint.example/w?k1=...&amount=21000"}'

The NIP-98 event must be kind 27235, signed within 60 seconds, with u set to the full URL, method set to POST, and payload set to the SHA-256 of the exact body sent. The key that signs it owns the name. No pubkey in the body is accepted, and there is no account, no password and no recovery.

A paid registration hands over a note of this mint, as a URL or as a bare secret. The mint burns the whole note - liabilities drop and the sats are revenue - so send one worth exactly the price; split first if you need to. A note worth less than the price is refused, and so is one from another host. Nothing is burned unless the name is granted: the burn and the registration are one transaction.

Names are ^[a-z0-9][a-z0-9_.-]{2,31}$. The mint's own username, _, admin and mint are reserved, as is any name already taken, or held for an unpaid address fee. A name a Nostr key owns is permanent; removing one is the operator's, through moneyer admin names rm. A name registered by its share alone is freed by that share's own unregister (below).

A registered name resolves on both rails at once:

  • name@mint.example as a lightning address, paying out as a bearer note gift-wrapped to the owner's key.
  • GET /.well-known/nostr.json?name=<name> as a NIP-05 address. Only the name asked for is answered: the list of everyone here is not something to hand out.

The discovery endpoint advertises namePriceMsat while registration is open, so a wallet can offer the flow without asking.

A name that pays to your own keys (LUD-26 Lightning Address)

A name with a share is an ordinary LUD-26 Lightning Address: payments to it are minted to the holder's own keys, never to a secret this mint draws. A share is a BIP-32 extended public key the wallet hands out for this one address, cx1 = bech32m("cx", chaincode || P) (65 bytes, 113 characters), and its notes are S/a'/2/n'/i, which the mint works out with plain BIP-32 CKDpub and can never spend.

There are two doors onto the same names.

LUD-26's own, at the address itself, form-encoded, every answer HTTP 200 with Access-Control-Allow-Origin: * and the PUT/DELETE preflight answered:

POST   /.well-known/lnurlp/<name>   cx1=<cx1>&sig=<hex>                  register
PUT    /.well-known/lnurlp/<name>   cx1=<new cx1>&sig=<hex>&newsig=<hex> move to a new share
DELETE /.well-known/lnurlp/<name>   sig=<hex>                            unregister

sig is a BIP-340 signature by the share's own key p over tagged_hash("LNURLcash/register", "<domain>:<name>:<cx1>"), <domain> being this mint's hostname; a PUT's sig is by the key on file over tagged_hash("LNURLcash/update", "<domain>:<name>:<new cx1>") and its newsig by the new share over the register message; DELETE signs tagged_hash("LNURLcash/unregister", "<domain>:<name>"). A name registered this way is owned by its share and by no Nostr key, so it has no NIP-05 entry and takes no zaps, though any wallet can pay it. An unsigned npub is refused, not bound: it would let anyone tie a name here to somebody else's Nostr identity. The refusals are LUD-26's: already registered, cx1 already used, unknown user, and Invalid ownership signature.

The address fee is the name price, MONEYER_NAME_PRICE_MSAT. With one set, a valid registration is answered {"status": "OK", "pr": "<invoice>"} and the name is held for that registration only while the hour-long invoice can still be paid, and ten minutes beyond, so a payment in its last seconds is seen before anyone else can take the name; it is published once the invoice settles and freed if it expires. The invoice quotes the fee. Lightning wallets can pay any registration invoice. Moneyer can also settle it from one of its own notes when the funding source lets Moneyer choose the invoice preimage. A PUT is free.

POST /names, NIP-98 as above, with "cx1" and "sig" (the historical NIP-98 registration digest) in the body: the Nostr key owns the name and the share decides where it pays. "cx1": null with an unregister proof by the share on file clears it, and the name pays out as a gift-wrapped note again. A cx1 on file is never overwritten by either door's POST: a move is the PUT. Deleting a share from a name a Nostr key owns only clears the share; the name stays that key's. This works while registration is closed too: closing it stops new names, not the owner of one choosing where it pays, including a name the operator set up in MONEYER_ZAP_NAMES.

Either way, no share's x(P) is ever accepted twice, here or under another name, even after it is unregistered, so a captured proof never applies again.

When a payment to the name settles, the mint takes the share's next index, skipping any key already holding a note, and credits the note to that key. An invoice nobody pays takes no index, so a wallet scanning its share never meets a gap it did not make. A name a Nostr key owns still gets a gift wrap, carrying no secret: https://mint.example/w?p=<cp1>&c=<cs1>&i=<index> and an i tag. A name with no Nostr key gets nothing: the note waits for the holder's scan.

The payRequest carries this mint's withdrawLink and mint fees and sets no commentAllowed, which is how a wallet knows the address is on this mint. It publishes no key of the share: the text/cpub hint is gone, since anyone who fetched it could watch the share. A payer holding a note here pays without Lightning instead, sending the note to the callback: /z/cb/<name>?amount=<the note's full value>&k1=<spend>. The note is burned and its whole value credited to the share's next key, free of any fee; a retry is answered {"status": "OK"} again. A +tag names the same address.

A name registered before LUD-26 keeps the whole-branch cx1 it was given and the old purpose-2 keys, so it keeps working, but publishes no key any more. Its owner moves it to a share with a PUT, signed by the old branch key (or the old purpose-0 index-0 key), or clears it and sets a share.

Reaching the mint over Tor

Set MONEYER_ONION_URL to this mint's hidden service address and a request that arrives on that host gets every URL built from it: the callback, the withdrawLink, the payLink, the lightning address in the metadata.

Without it a Tor visitor is answered with the clearnet origin, and their wallet is then told to leave Tor to finish the job - the cal B201 lback fetch goes out over clearnet, from their address, naming the mint they bank with. That is worse than not working, because it looks like it worked.

The Host header chooses between origins here; it never builds one. MONEYER_PUBLIC_ORIGIN exists precisely because the header is attacker controlled, and that property is unchanged: the worst a forged Host can do is get back the onion URL instead of the clearnet one, and the operator configured both. Anything else falls through to MONEYER_PUBLIC_ORIGIN.

Serving both audiences at once

Both doors serve the same notes. A note is keyed by its Q and not by host, so a k1 struck on the onion is valid at the clearnet host and the other way round. A ck1 is bound to a domain, and both of this mint's domains are its own, so one signed for either host is accepted at both. What is bound to a host is only the URL a note travels as - and an onion note handed to somebody without Tor is unspendable to them, while a clearnet note redeemed over Tor is private only if their wallet proxies.

So when both are configured, /w and the mint address name the other one in mirrors:

{"tag": "withdrawRequest", "callback": "http://<v3>.onion/w/cb",
 "mirrors": ["https://mint.example"], "mintPubkey": "..."}

Absent when there is only one door, rather than an empty array - a wallet reading [] would think it had been told something. The hourly Nostr announcement carries it too, so a wallet that discovers this mint on a relay learns both doors before it holds anything.

A wallet must not fail over to a mirror on its own. Every request that identifies a note carries the k1, so switching hosts discloses a bearer secret to the new one, and nothing in LUD-25 lets a host prove it is the same mint before receiving that secret - a hostile discovery document can name any host and claim any mintPubkey, because claiming is not proving. Show the holder the other door and let them choose it. Closing that properly needs a challenge the mint signs, which the spec does not have yet.

Running the hidden service itself is not this mint's job. Point a Tor HiddenServiceDir (or a proxy that speaks onion) at whatever host and port it already listens on, the same way you would front it with Caddy for clearnet.

Endpoints

/.well-known/lnurlp/<user> LUD-16 payRequest; paying mints a note
/.well-known/lnurlp/<name> a registered name's payRequest: with a share, a LUD-26 Lightning Address (withdrawLink, no commentAllowed, no key); without, NIP-57, paying mints a note gift-wrapped to the name's pubkey. mint@ is always the mint's own; <name>+<tag> is <name>
POST/PUT/DELETE /.well-known/lnurlp/<name> LUD-26 registration, move and unregister, proven by the share's key; form-encoded, HTTP 200 with CORS
/.well-known/lnurlw/<user> LUD-25 mint address discovery (experimental)
/p/cb LUD-06 pay callback; issues the mint invoice for the note the comment names, a hash or a cp1 key (h is an older spelling for a hash)
/z/cb/<name> the name's callback: an invoice (validating a kind 9734 when zapped), or a form-encoded POST with k1 for a LUD-26 internal transfer
/verify/<token> LUD-21 verify, for mint invoices and melt payments
/w LUD-03 informational GET; accepts k1 (a preimage, ck1 or cw1, verified in full) or the non-disclosing LUD-25 p check (a bearer note's h or any cp1; h is its older name, still accepted); a live note carries payLink and its certificate in lnurlcash.c
/w/cb GET melt using k1 and pr. Form-encoded POST swap using repeated k1, p and amount fields.
POST /names claim a lightning address, authenticated by NIP-98
/.well-known/nostr.json NIP-05 for the names this mint serves
/stats what the mint owes, what the node holds, and the coverage between them
/metrics the same figures for a scraper, off by default

Operating

set -a; source /etc/moneyer/env; set +a
moneyer admin status

moneyer admin reads the same MONEYER_* environment the mint does, so there is one description of a deployment and not two. It opens the database read-only unless the command mutates: an operator poking at a live mint should not be able to write to it by accident, and a mistyped path should not silently create an empty database to answer from.

command does
status liabilities, melts in flight, unsettled invoices, node balance and coverage, lifetime totals, keys
notes [--state outstanding|pending|burned] [--limit n] list notes, newest first
note <id|k1> one note; 64 hex that names no note is hashed and looked up as the secret
melts [--pending] list melts
reconcile one pending-melt reconcile pass, printing what changed
sweep delete expired mint invoices the funding source confirms unpaid, and mint the notes of any it finds paid
snapshot <path> a consistent copy of the database, taken live, refusing to overwrite
names list|add <name> <npub>|rm <name> the lightning addresses this mint pays out as notes
keys rotate generate a signing key and print the two environment lines; writes nothing
verify-note <url> check a note's signature offline, then say what the mint holds at that id

snapshot uses SQLite's VACUUM INTO, so it needs no sqlite3 binary on the box and is safe to run against a live mint.

Metrics

MONEYER_METRICS=true serves GET /metrics in the OpenMetrics text format: moneyer_outstanding_msat, moneyer_outstanding_notes, moneyer_pending_melts, moneyer_oldest_pending_melt_seconds, moneyer_local_balance_msat, moneyer_unsettled_mint_invoices, moneyer_mints_total, moneyer_melts_total{outcome} and moneyer_zaps_total.

The app does not authenticate it. Restrict the path to your scraper at the reverse proxy, the way /stats is left public deliberately and this is not.

The three alerts worth having

  • oldest pending melt over 30 minutes. A melt that cannot be resolved is a note nobody can spend and a payment nobody can account for. The reconciler retries every five minutes; half an hour without a terminal answer means the funding source needs looking at.
  • coverage under 1. The node cannot pay out every note it owes. Whether that is a channel imbalance or something worse, it is the one number a custodial mint must never be relaxed about.
  • unsettled invoices growing. Invoices are issued and never paid all day, and the sweep clears the expired ones the funding source confirms unpaid. A count that climbs through a sweep means invoices are being issued that nobody can pay, or that the funding source is not answering.

Testing

npm test          # vitest: protocol, signing, melt discipline, conformance

The conformance grader runs inside the suite against an in-process mint, read-only and spending paths both. The cln and lnd backends are direct ports of the reference mint's semantics but have not yet been exercised against live nodes; treat them as beta until they have.

Dogfood

Part of the ForgeSworn LNURLcash stack: built on @lnurlcash/kit (fee maths, hashing, signature agreement) and farrier-kit (BOLT-11 decoding and preimage verification on the melt path). The companion wallet is @forgesworn/notecase.

Other mints, wallets and libraries speaking the same protocol are indexed in awesome-lnurlcash.

Licence

MIT.

Comment protection

A current LUD-25 mint quote must carry a LUD-12 comment holding hex(sha256(secret)), naming the note the payment will mint. The note is then keyed by the wallet's own secret, and the payment preimage redeems nothing.

Moneyer unconditionally refuses a missing or malformed comment before any invoice is issued. The former MONEYER_REQUIRE_COMMENT switch has been removed: allowing the preimage-backed fallback would now violate the draft and expose a bearer secret to every routing hop.

The rule also supports funding sources that settle without returning a preimage. There is no bearer credential to recover from the payment path; the wallet already persisted it before asking for the invoice.

The compatibility boundary is explicit: a wallet that has never heard of LNURLcash sends a bare LUD-06 request and gets an error rather than an invoice. Existing notes remain ordinary LUD-03 withdraw links and continue to redeem normally.

About

An LNURLcash (LUD-25) mint - strikes Lightning bearer notes. Independent implementation: cln/lnd funding sources, SQLite, conformance-graded.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0