lnurl / luds

lnurl specifications
584 stars 138 forks source link

HODL invoice support #219

Open PatrickGeyer opened 1 year ago

PatrickGeyer commented 1 year ago

Suggest adding optional extra parameters to LUD-06 callback endpoint: cltv_expiry and expiry.

With the rise of serverless Nostr apps, we may want hodl invoice functionality to allow trustless escrows to operate over lightning.

E.g. I launch a NIP-15 marketplace, and would like a 3rd party escrow to manage payments from buyers. I don't want the escrow to custody the funds, so I need to generate an invoice myself and give the escrow just the hash. When the buyer sends me a checkout message over nostr, the seller can trigger the escrow service, which looks up the seller's nostr profile, finds the lightning address, pings the lnurl address with some extra parameters to return an invoice that has a long enough timeout for the transaction. E.g. 1 week until product is definitely shipped. The escrow could also include json of the nostr event in question so that the lightning node can't be spammed by long-timeout-invoice creation requests that don't correspond to a real order.

PatrickGeyer commented 1 year ago

I'm imagining that the way to get escrows into nostr apps is to have escrow broadcast their service availability via Nostr messages. That way, nostr clients don't have to hard-code escrow services, but can search them in real time.

See draft spec here: https://github.com/PatrickGeyer/nips/blob/master/XX.md

If anyone knows of a better way to do non-custodial escrow system over lightning, all ears!

fiatjaf commented 1 year ago

I agree this would have been a nice thing to have.

PatrickGeyer commented 1 year ago

@fiatjaf Looks like plenty of wallets implemented Zap addition to LNURL endpoints. Do you think if HODL invoices become the way to do trust-minimized transactions for nostr apps, wallets would be able to implement these extra two parameters? Would only need one wallet to support for a proof of concept. If I'm running a nostr marketplace I may not mind setting up a new wallet which supports hodl invoices. Maybe after proof of concept the idea would become more refined and lightning network more resilient to HODL type transactions.