You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HRN: Emit new event type when Offer has been received and validated #3779
Currently, when using the ChannelManager::pay_for_offer_from_human_readable_name API, the user gets no access to the offer data retrieved. It would be great to add a new event type that is emitted when the offer has been retrieved and validated, e.g. here:
Hmm, is there a reason you need the Offer directly or can you just access the offer fields via the Bolt12Invoice when the payment ultimately completes (which I believe was added upstream but is not in 0.1)?
Hmm, is there a reason you need the Offer directly or can you just access the offer fields via the Bolt12Invoice when the payment ultimately completes (which I believe was added upstream but is not in 0.1)?
Hmm, IIUC, PaymentSent would only give us the Bolt12Invoice, which doesn't even expose OfferId, for instance. But more generally: the payment might very well fail and we'd still like to be able to fill in some of the metadata fields and maybe even retry using the Offer, which would save us multiple RTTs for resolving/retrieving the offer once more.
Hmm, IIUC, PaymentSent would only give us the Bolt12Invoice, which doesn't even expose OfferId, for instance.
that's easy to fix, though, and likely it should :).
But more generally: the payment might very well fail and we'd still like to be able to fill in some of the metadata fields
Hmm? Like what? I'm not really sure there's much to fill in from an Offer derived from an HRN - its really just a blinded path to request an Invoice?
maybe even retry using the Offer, which would save us multiple RTTs for resolving/retrieving the offer once more.
That's one RTT, but I guess I'm not clear on the point of that? Like, DNS should move pretty quick, hopefully, and if an Offer request times out its probably already retried a few times and we've waited a while. Adding one RTT on top of the retry seems perfectly fine?
That's one RTT, but I guess I'm not clear on the point of that? Like, DNS should move pretty quick, hopefully, and if an Offer request times out its probably already retried a few times and we've waited a while. Adding one RTT on top of the retry seems perfectly fine?
The point is that we already retrieved the offer and still would have an entirely blank entry in the payment store even though we could provide the user additional metadata.
Right, I guess I'm missing what that metadata is? Like, we can give the user an OfferId, but I'm not really sure if they care? They certainly care about OfferIds when they sent an offer and can use it to track the payment, but here they can't (they have to use the HRN - multiple HRNs can even resolve to the same Offer!). The Offer won't have an amount or much in it, or certainly shouldn't, so there shouldn't be any fields they care about in it.
Well, in LDK it would be all the fields of PaymentKind::Bolt12Offer, plus the actual Offer storage, which we're about to add support for currently.
Like, we can give the user an OfferId, but I'm not really sure if they care? They certainly care about OfferIds when they sent an offer and can use it to track the payment, but here they can't (they have to use the HRN - multiple HRNs can even resolve to the same Offer!). The Offer won't have an amount or much in it, or certainly shouldn't, so there shouldn't be any fields they care about in it.
Honestly, I'm not quite following why this is controversial at all? LDK retrieves the offer from DNS, why can't we give the user a way to access what we retrieved? FWIW, pay_for_offer_from_human_readable_name currently returns Result<(), ()> which gives the user 0 semantic feedback about what happend, what immediately succeeded/failed, what the OfferId is, etc. Of course, all of the protocol steps are happening async in the background, so we can only provide more information by emitting an event.
its a question of what the API should look like so that there's a consistent view of what's going on - paying a BIP 353 isn't strictly just paying an offer, and to some extent I regret having a "pay for offer from BIP 353" method because a BIP 353 can also be on-chain but could also be silent payments or cashu or...
Having an API where someone pastes in a human readable name and then expects to get back an OfferId or really any additional offer metadata seems really wrong to me - its just a payment, for an amount, with a fee. There may be some additional metadata, but tying it to offers specifically just feels totally wrong.
Having an API where someone pastes in a human readable name and then expects to get back an OfferId or really any additional offer metadata seems really wrong to me - its just a payment, for an amount, with a fee. There may be some additional metadata, but tying it to offers specifically just feels totally wrong.
Well, I'd argue it's the other way around: we def. need to track the concrete payment, including all metadata the kind of payment supports (including things like Txid, OfferId, payment hash, etc., depending on what we use). So yes, assuming an HRN always resolves to an offer is wrong, but in LDK Node we'd track the concrete payment and attach the HRN metadata if the payment happens to be the result of a HRN resolution.
Hmm, that might indeed make more sense, at least if we're then also committed to drop the pay_for_offer_from_hrn API from core LDK? And how would we deal with it in the meantime?
Appreciate you looking into this! I've been monitoring this issue too, but I'm currently waiting for the maintainers to wrap up their discussion before starting any work. Happy to coordinate once they give the green light!
Thanks for your interest, but as @chuksys mentioned the discussion is just pending a final resolution, at which point it's already assigned to him. So feel free to look around for another open issue.
Well, I'd argue it's the other way around: we def. need to track the concrete payment, including all metadata the kind of payment supports (including things like Txid, OfferId, payment hash, etc., depending on what we use). So yes, assuming an HRN always resolves to an offer is wrong, but in LDK Node we'd track the concrete payment and attach the HRN metadata if the payment happens to be the result of a HRN resolution.
But what's the point of an id that only appears after the payment is halfway done? Txids obviously need to be tracked because the user will want to see them to get a link to a block explorer, similar to some extent with payment hash/preimage, but "offer ids" are an LDK-specific concept. IOW we need a "proof of payment" fetching API, but I'm not sure I see why someone would want a hash of the offer?
Obviously there's a need for "payment ids" but in order to be useful they need to be static for the lifetime of the payment, not there halfway through.
Hmm, that might indeed make more sense, at least if we're then also committed to drop the pay_for_offer_from_hrn API from core LDK? And how would we deal with it in the meantime?
Don't think we're at a point where we're likely to drop that (maybe eventually but it'll be a while, incl we need the payment instructions crate to be able to use onion messages to resolve the DNS entry).
But what's the point of an id that only appears after the payment is halfway done?
It won't be when it's half way done, it will be there when it's not even attempted yet.
but "offer ids" are an LDK-specific concept.
Yes, and they are the only way how user can associate payment (attempts) with offers.
there's a need for "payment ids" but in order to be useful they need to be static for the lifetime of the payment
We have that concept in place, but retrieving metadata/resolving the HRN is different from attempting the payment.
I really think we should expose ways for users to access the current state across all the individual steps. We had the same conversation with BOLT12 to begin with, where the initially locked-down API was just insufficient. Going forward, we will need to be able to resolve the HRN, and then handle whatever it resolved to differently. So we need to expose whatever we resolved the HRN to to the user. As that thing is not part of the payment, it's the thing we need to start the payment. I guess if we won't expose that intermediate step in LDK raw, I might be tempted to reimplement HRN resolution in LDK Node itself.
I really think we should expose ways for users to access the current state across all the individual steps. We had the same conversation with BOLT12 to begin with, where the initially locked-down API was just insufficient. Going forward, we will need to be able to resolve the HRN, and then handle whatever it resolved to differently. So we need to expose whatever we resolved the HRN to to the user. As that thing is not part of the payment, it's the thing we need to start the payment. I guess if we won't expose that intermediate step in LDK raw, I might be tempted to reimplement HRN resolution in LDK Node itself.
Right, okay, so this is a somewhat separate usecase then I was thinking. IMO we should kinda rip the HRN -> offer stuff out of ChannelManager because, to your point, its too locked down to be useful. Rather than telling the user what the HRN resolves to, we should have them resolve it. I have some old code somewhere that would let bitcoin-payment-instructions do resolution over onion messages but it was blocked on some upstream changes I've long since lost. We should revive that work and encourage folks to use bitcoin-payment-instructions to resolve HRNs and then decide how to pay on their own.
Right, okay, so this is a somewhat separate usecase then I was thinking. IMO we should kinda rip the HRN -> offer stuff out of ChannelManager because, to your point, its too locked down to be useful. Rather than telling the user what the HRN resolves to, we should have them resolve it. I have some old code somewhere that would let bitcoin-payment-instructions do resolution over onion messages but it was blocked on some upstream changes I've long since lost. We should revive that work and encourage folks to use bitcoin-payment-instructions to resolve HRNs and then decide how to pay on their own.
Hmm, okay. What does that mean concretely? Should I open a PR removing all the HRN-related stuff from lightning? If we would have resolution happen outside of lightning, what would be the interface to still make use of LDK's onion messenger for bLIP-32 though? Given this seems to be all a bunch of work, how would we bridge the time until all of this lands everywhere? Are we fine with intermittently not offering our users any way to resolve HRNs?
We now decided on not exposing additional information via a new event, but rather leveraging the changes in rust-bitcoin/bitcoin-payment-instructions#6 to allow LDK Node to use bitcoin-payment-instructions directly to resolve HRNs, and then take action depending on what they resolve to. I.e., we won't be using LDK's pay_for_offer_from_human_readable_name API for LDK Node HRN integration.
Activity
TheBlueMatt commentedon May 15, 2025
Hmm, is there a reason you need the
Offerdirectly or can you just access the offer fields via theBolt12Invoicewhen the payment ultimately completes (which I believe was added upstream but is not in 0.1)?tnull commentedon May 15, 2025
Hmm, IIUC,
PaymentSentwould only give us theBolt12Invoice, which doesn't even exposeOfferId, for instance. But more generally: the payment might very well fail and we'd still like to be able to fill in some of the metadata fields and maybe even retry using theOffer, which would save us multiple RTTs for resolving/retrieving the offer once more.chuksys commentedon May 16, 2025
I'd like to pick this up.
tnull commentedon May 19, 2025
Sure, go for it!
TheBlueMatt commentedon May 19, 2025
that's easy to fix, though, and likely it should :).
Hmm? Like what? I'm not really sure there's much to fill in from an
Offerderived from an HRN - its really just a blinded path to request anInvoice?That's one RTT, but I guess I'm not clear on the point of that? Like, DNS should move pretty quick, hopefully, and if an Offer request times out its probably already retried a few times and we've waited a while. Adding one RTT on top of the retry seems perfectly fine?
tnull commentedon May 20, 2025
The point is that we already retrieved the offer and still would have an entirely blank entry in the payment store even though we could provide the user additional metadata.
TheBlueMatt commentedon May 22, 2025
Right, I guess I'm missing what that metadata is? Like, we can give the user an
OfferId, but I'm not really sure if they care? They certainly care aboutOfferIds when they sent an offer and can use it to track the payment, but here they can't (they have to use the HRN - multiple HRNs can even resolve to the sameOffer!). TheOfferwon't have an amount or much in it, or certainly shouldn't, so there shouldn't be any fields they care about in it.tnull commentedon May 23, 2025
Well, in LDK it would be all the fields of
PaymentKind::Bolt12Offer, plus the actualOfferstorage, which we're about to add support for currently.Honestly, I'm not quite following why this is controversial at all? LDK retrieves the offer from DNS, why can't we give the user a way to access what we retrieved? FWIW, pay_for_offer_from_human_readable_name currently returns
Result<(), ()>which gives the user 0 semantic feedback about what happend, what immediately succeeded/failed, what theOfferIdis, etc. Of course, all of the protocol steps are happening async in the background, so we can only provide more information by emitting an event.TheBlueMatt commentedon May 23, 2025
its a question of what the API should look like so that there's a consistent view of what's going on - paying a BIP 353 isn't strictly just paying an offer, and to some extent I regret having a "pay for offer from BIP 353" method because a BIP 353 can also be on-chain but could also be silent payments or cashu or...
Having an API where someone pastes in a human readable name and then expects to get back an OfferId or really any additional offer metadata seems really wrong to me - its just a payment, for an amount, with a fee. There may be some additional metadata, but tying it to offers specifically just feels totally wrong.
I do kinda wonder if ldk-node shouldn't instead by using https://docs.rs/bitcoin-payment-instructions/ to parse these (which hopefully post-LDK-0.2 will support doing the DNS lookup over onion messages for privacy).
tnull commentedon May 26, 2025
Well, I'd argue it's the other way around: we def. need to track the concrete payment, including all metadata the kind of payment supports (including things like Txid, OfferId, payment hash, etc., depending on what we use). So yes, assuming an HRN always resolves to an offer is wrong, but in LDK Node we'd track the concrete payment and attach the HRN metadata if the payment happens to be the result of a HRN resolution.
Hmm, that might indeed make more sense, at least if we're then also committed to drop the
pay_for_offer_from_hrnAPI from core LDK? And how would we deal with it in the meantime?ouchennnn commentedon May 29, 2025
can I take this ?
chuksys commentedon May 29, 2025
Appreciate you looking into this! I've been monitoring this issue too, but I'm currently waiting for the maintainers to wrap up their discussion before starting any work. Happy to coordinate once they give the green light!
tnull commentedon May 30, 2025
Thanks for your interest, but as @chuksys mentioned the discussion is just pending a final resolution, at which point it's already assigned to him. So feel free to look around for another open issue.
TheBlueMatt commentedon May 30, 2025
But what's the point of an id that only appears after the payment is halfway done? Txids obviously need to be tracked because the user will want to see them to get a link to a block explorer, similar to some extent with payment hash/preimage, but "offer ids" are an LDK-specific concept. IOW we need a "proof of payment" fetching API, but I'm not sure I see why someone would want a hash of the offer?
Obviously there's a need for "payment ids" but in order to be useful they need to be static for the lifetime of the payment, not there halfway through.
TheBlueMatt commentedon May 30, 2025
Don't think we're at a point where we're likely to drop that (maybe eventually but it'll be a while, incl we need the payment instructions crate to be able to use onion messages to resolve the DNS entry).
tnull commentedon Jun 3, 2025
It won't be when it's half way done, it will be there when it's not even attempted yet.
Yes, and they are the only way how user can associate payment (attempts) with offers.
We have that concept in place, but retrieving metadata/resolving the HRN is different from attempting the payment.
I really think we should expose ways for users to access the current state across all the individual steps. We had the same conversation with BOLT12 to begin with, where the initially locked-down API was just insufficient. Going forward, we will need to be able to resolve the HRN, and then handle whatever it resolved to differently. So we need to expose whatever we resolved the HRN to to the user. As that thing is not part of the payment, it's the thing we need to start the payment. I guess if we won't expose that intermediate step in LDK raw, I might be tempted to reimplement HRN resolution in LDK Node itself.
TheBlueMatt commentedon Jun 13, 2025
Right, okay, so this is a somewhat separate usecase then I was thinking. IMO we should kinda rip the HRN -> offer stuff out of
ChannelManagerbecause, to your point, its too locked down to be useful. Rather than telling the user what the HRN resolves to, we should have them resolve it. I have some old code somewhere that would letbitcoin-payment-instructionsdo resolution over onion messages but it was blocked on some upstream changes I've long since lost. We should revive that work and encourage folks to usebitcoin-payment-instructionsto resolve HRNs and then decide how to pay on their own.tnull commentedon Jun 18, 2025
Hmm, okay. What does that mean concretely? Should I open a PR removing all the HRN-related stuff from
lightning? If we would have resolution happen outside oflightning, what would be the interface to still make use of LDK's onion messenger for bLIP-32 though? Given this seems to be all a bunch of work, how would we bridge the time until all of this lands everywhere? Are we fine with intermittently not offering our users any way to resolve HRNs?tnull commentedon Jun 25, 2025
Gentle ping here, @TheBlueMatt
tnull commentedon Jul 1, 2025
We now decided on not exposing additional information via a new event, but rather leveraging the changes in rust-bitcoin/bitcoin-payment-instructions#6 to allow LDK Node to use
bitcoin-payment-instructionsdirectly to resolve HRNs, and then take action depending on what they resolve to. I.e., we won't be using LDK'spay_for_offer_from_human_readable_nameAPI for LDK Node HRN integration.Closing this.