cashubtc / nuts

Cashu protocol specifications https://cashubtc.github.io/nuts/
MIT License
150 stars 52 forks source link

Return preimage in PostMintQuoteBolt11Response for paid invoices #168

Closed rolznz closed 1 month ago

rolznz commented 1 month ago

Currently in Alby Hub we expect every paid transaction to have a preimage and we think this is important for data consistency so are hesitant about removing this check. I think other wallets would also want to show the preimage in the transaction list for settled payments, even received ones.

See https://github.com/getAlby/hub/issues/651

bumi commented 1 month ago

+1 I don't know the cashu API but I think any lightning payment related call should return the preimage

prusnak commented 1 month ago

@callebtc @thesimplekid is it always guaranteed that the pre-image is always available?

callebtc commented 1 month ago

I'm not sure if this post relates to a melt or a mint request. Assuming the title is correct, it would mean that we return a preimage when creating an incoming invoice. This is in most cases not possible. Most Lightning backends do not return the preimage when you create an invoice.

For melts, we do return the preimage (whenever possible, some backends do not support this either) in the PostMeltQuoteBolt11Response, see NUT-05.

rolznz commented 1 month ago

@callebtc for minting, when checking if the invoice is paid (by checking the PostMintQuoteBolt11Response). If the invoice is paid already then there should be no issue returning the preimage in this response, right?

callebtc commented 1 month ago

@callebtc for minting, when checking if the invoice is paid (by checking the PostMintQuoteBolt11Response). If the invoice is paid already then there should be no issue returning the preimage in this response, right?

Most backends do not provide you with this information, no.

bumi commented 1 month ago

Most backends do not provide you with this information, no.

what are most backends? and why do they not provide that information? how do you know the invoice is paid?

callebtc commented 1 month ago

I can't answer these questions because I'm not responsible for designing these backends. I'm just stating it as a fact and that's why this feature request can't be met.

bumi commented 1 month ago

ok,understandable. as a follow up:

callebtc commented 1 month ago
  • how do you know the invoice is actually paid?

I don't understand. The payer can prove it by showing the preimage. We provide the preimage to a paying Cashu wallet.

Are you referring to the receiver (like the top post)? There is no way to prove you've received a Lightning payment that I know of.