A standalone web app that implements a lightning paywall: you need to pay 21 sats to unlock the hidden content.
How it works:
- The app fetches a 19 sats invoice from bordalix@coinos.io
- Then it creates a melt quote with this invoice
- In return the app gets:
- amount = 19 sats
- fee_reserve = 2 sats
- Then it creates a mint quote of 21 sats
- In return the app gets a payment request (aka ln invoice)
- It shows this invoice to the user
- Pools the mint every 5 seconds waiting for the invoice to be paid
- When paid, it mints the proofs
- Uses the proofs to melt and pay for the first invoice
- Receives a change of 2 sats and sends it to me via Nostr
It’s not perfect, the user can inspect the code and:
- Change the value to pay to 3 sats
- Change bordalix@coinos.io to his own lnurl
- Access the content in the code (is obfuscated, but is there)