Integrate Gateway with LSP Spec #3139
Replies: 9 comments 3 replies
-
@justinmoon Can you describe your HTLC interception use case? LDK supports it but as you note LDK Node does not. We're planning to be very conservative expanding the LDK Node API but if there is a strong need by many users for something it will certainly be considered. |
Beta Was this translation helpful? Give feedback.
-
Forgive me, I don't recall what fedimint needs exactly anymore - why does it need HTLC interception? My recollection was that it really only needs the ability to use its own payment hashes and provide the preimages when it wants to. |
Beta Was this translation helpful? Give feedback.
-
Here's how a fedimint user receives ecash via lightning:
So I believe we use HTLC interception so that the gateway doesn't need to actually custody funds on behalf of Fedimint users, and instead does this swap between a preimage and ecash notes. We've already used LDK Node a little bit in some of our tests, I think if we wanted to implement the LSP spec it would probably be beneficial to actually use LDK. Gateway operators would then just need to run a gateway and not need a separate lightning node (although some users with existing lightning nodes will likely still want to do that). |
Beta Was this translation helpful? Give feedback.
-
Right, okay, so I don't think you actually need HTLC interception, you only need custom payment hashes/preimages - there's no need to "forward" the payment from the receipt to the federation, in fact doing so (correctly) would require extra work and dealing with Lightning onions. |
Beta Was this translation helpful? Give feedback.
-
Yes correct, no need to forward the HTLC to the federation. Without HTLC interception though I'm not sure how/when the Lightning Gateway would know when to go buy the preimage. The HTLC scid is how the gateway knows which federation has the preimage. Perhaps you had a different mechanism in mind. |
Beta Was this translation helpful? Give feedback.
-
I dunno about other lightning nodes (or ldk-node), but LDK in general identifies whether the payment hash has a known preimage or not based on the payment secret. Thus you'll see a different event come out of LDK without the SCID being different. |
Beta Was this translation helpful? Give feedback.
-
That sounds like it will work for our use case as well |
Beta Was this translation helpful? Give feedback.
-
https://github.com/lightningdevkit/lightning-liquidity is a related project that could help automate liquidity management of LDK node connecting to spec-compliant LSP. Docs are sparse, so we should reach out to devs when we want to explore more deeply. |
Beta Was this translation helpful? Give feedback.
-
I think since we have a concrete proposal for integrating LDK Node + LSP Spec we can close the discussion here and rather work in issues. #4095 |
Beta Was this translation helpful? Give feedback.
-
Here is a spec that a bunch of large LSPs like Breez and Block have agreed to build their APIs around.
Integrating this with our lightning gateway could have 2 benefits:
gatewayd
could just be one binary. This would make deployments marginally simpler.After talking to @johncantrell97, there are basically 2 directions here:
ldk-sample
andldk-lsp-client
.Beta Was this translation helpful? Give feedback.
All reactions