<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coinos-server.git/routes/preimages.ts, branch master</title>
<subtitle>coinos server — legacy coinos.io backend (Lightning, on-chain, Liquid)</subtitle>
<id>https://git.coinos.io/coinos-server.git/atom?h=master</id>
<link rel='self' href='https://git.coinos.io/coinos-server.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinos-server.git/'/>
<updated>2026-09-23T14:31:46Z</updated>
<entry>
<title>lightning: don't wedge the listener on an already-credited preimage</title>
<updated>2026-09-23T14:31:46Z</updated>
<author>
<name>Adam Soltys</name>
<email>adam@coinos.io</email>
</author>
<published>2026-09-23T14:31:46Z</published>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinos-server.git/commit/?id=bd54987e1f2d708f7e9c5e6e903bcd3c4502b495'/>
<id>urn:sha1:bd54987e1f2d708f7e9c5e6e903bcd3c4502b495</id>
<content type='text'>
Skip settlements whose preimage was already credited instead of retrying
until the process exits, and reject previously used preimages when they
are queued.

Co-Authored-By: Claude Opus 5.5 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>preimages: support fiat prices, converted at invoice-creation time</title>
<updated>2026-07-15T05:06:25Z</updated>
<author>
<name>Adam Soltys</name>
<email>adam@coinos.io</email>
</author>
<published>2026-07-15T05:06:25Z</published>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinos-server.git/commit/?id=81c3593f1eec7f94dc9cbc22edc3456fa57b95cb'/>
<id>urn:sha1:81c3593f1eec7f94dc9cbc22edc3456fa57b95cb</id>
<content type='text'>
POST /preimages now accepts fiat + optional currency (defaults to the
merchant's) as an alternative to a sat price. The fiat amount is stored
per entry and converted to sats at the moment a usePreimage invoice is
created, so the price tracks the exchange rate instead of freezing at
upload time. The invoice also takes on the entry's currency and rate so
receipts display the fiat price exactly as the merchant set it. If no
rate is available for the entry's currency, the preimage is pushed back
onto the queue and creation fails rather than issuing an any-amount
invoice.

Co-Authored-By: Claude Fable 5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>preimages: enforce a merchant-set price per preimage batch</title>
<updated>2026-07-14T03:22:06Z</updated>
<author>
<name>Adam Soltys</name>
<email>adam@coinos.io</email>
</author>
<published>2026-07-14T03:21:49Z</published>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinos-server.git/commit/?id=0d55c0ccceb378a9c1992f6e7d82a6786cdd19b8'/>
<id>urn:sha1:0d55c0ccceb378a9c1992f6e7d82a6786cdd19b8</id>
<content type='text'>
Invoice creation is unauthenticated, so buyers could name their own
price for a queued preimage (create the usePreimage invoice with
amount: 1). POST /preimages now takes an optional price (sats) that is
stored per entry and overrides the requested amount when the preimage
is consumed; omitting it keeps the old any-amount behavior. Also gate
the stored-preimage reveal in credit() on the invoice being fully paid,
since internal sends can settle partial amounts. Bare-hex entries
queued before this change still parse (treated as priceless).

Co-Authored-By: Claude Fable 5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>invoices: sell merchant-supplied preimages via a usePreimage queue</title>
<updated>2026-07-11T04:46:40Z</updated>
<author>
<name>Adam Soltys</name>
<email>adam@coinos.io</email>
</author>
<published>2026-07-11T04:46:40Z</published>
<link rel='alternate' type='text/html' href='https://git.coinos.io/coinos-server.git/commit/?id=d466aab4451a89b2d69a2618f0a739b2e89903c5'/>
<id>urn:sha1:d466aab4451a89b2d69a2618f0a739b2e89903c5</id>
<content type='text'>
Merchants POST /preimages (auth) to pre-load 32-byte hex preimages into a
FIFO queue; creating an invoice with usePreimage: true consumes the next
one so the invoice's payment hash is sha256(preimage). Paying the invoice
reveals the merchant-chosen secret to the buyer — via their own wallet on
external settlements, and via GET /invoice/:id once settled — enabling
backend-less digital download stores (encrypted files on static hosting,
preimage + public string = decryption key).

- GET /preimages lists the queue with payment hashes so the merchant can
  map files to future invoices; POST /preimages/delete clears it
- empty queue fails invoice creation rather than issuing a random
  preimage the buyer would pay for but couldn't decrypt with
- preimages cln rejects as already used are discarded and the next tried
- consumed preimages persist at preimage:${payment_hash} (TTL = invoice
  expiry) and credit() prefers them as the settlement ref, so internal
  coinos-to-coinos payments reveal the real preimage instead of the
  sender's uid

Co-Authored-By: Claude Fable 5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
