Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: add RPC endpoint for generating LN Invoices for Tap assets #884

Open
ffranr opened this issue Apr 17, 2024 · 3 comments
Open
Assignees
Milestone

Comments

@ffranr
Copy link
Contributor

ffranr commented Apr 17, 2024

Description

This issue proposes the implementation of a new RPC endpoint to facilitate generating a lightning network invoice for receiving tap assets over a lightning channel.

Arguments

The RPC endpoint should accept the following parameters:

  • AssetId: Identifier for the asset the receiving node wishes to receive.
  • Amt: Amount of the specified asset that the receiving node wishes to receive.
  • RoutingPeer: A serialized, compressed Bitcoin public key (route.Vertex) identifying the routing peer. This peer acts as the final hop in the BTC payment channel, converting BTC into the AssetId and paying the invoice-generating node in the specified tap asset.

Invoice Generation Functionality

The tapd node should execute the following steps to generate an invoice:

  1. Check the given AssetId. If the asset is unknown, retrieve asset details from a known universe.
  2. Utilize the RFQ (Request for Quote) service to negotiate and finalize a quote with the specified routing peer. This step is crucial for determining the scid (short channel ID) for the invoice, the BTC amount to be used in the invoice, and the final expiry time of the invoice.
  3. Interface with lnd to generate an invoice based on the agreed terms.
  4. Amend the last hop hint in the generated invoice using the RFQ quote to specify the routing peer, ensuring correct routing and asset conversion.

The endpoint should return the modified lightning invoice to the caller.

@ffranr
Copy link
Contributor Author

ffranr commented Apr 19, 2024

This RPC endpoint should return a status channel instead of directly providing an invoice, given that invoice generation can be time-consuming due to processes like RFQ negotiation, universe synchronization, and calls to LND. Implementing a status channel in this endpoint will prevent the caller from being blocked while these operations are executed.

@dstadulis dstadulis added this to the ⚡️PoC⚡️ milestone Apr 27, 2024
@ffranr
Copy link
Contributor Author

ffranr commented May 7, 2024

I don't think we've got a solid plan in place for this issue. Right now, for the PoC, this functionality is in lightning terminal.

@dstadulis
Copy link
Collaborator

Moving to v0.4.1 as IIUC it's related to lnd operating in remote mode

@dstadulis dstadulis modified the milestones: ⚡️PoC⚡️, v0.4.1 May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 💇‍♂️Needs Shaping
Development

No branches or pull requests

2 participants