2

I am building a web service where User A will signup and enter a Lightning address attached to the profile.

Then, User B would want to send some satoshi to the Lightning address of User A as a kind of a donation.

So, I want User A to click a button on my site "Donate this user", and a fixed/preentered amount would be sent to User B.

However, as Lightning network requires an invoice to be created before sending satoshis, I have a question:

Can I choose any existing and valid Lightning address, not being its owner, and generate a valid invoice for it in order to send a payment right after generation?

For the user it would be hidden and made automatically.

Any advice is appreciated.

2
  • 2
    Perhaps BOLT12 or keysend payments is what you're looking for. You can pay with only one's node id. However, this requires the receiving peer to have a node and be online. Commented Apr 4, 2022 at 19:05
  • You should check the donations plugin.
    – Angelo
    Commented Aug 26, 2022 at 11:42

1 Answer 1

3

When you mention "Lightning address" here, from the rest of the question I assume you mean a Lightning node's ID or public key. If this is the case, then you absolutely cannot create a BOLT11 invoice for an arbitrary node as invoices need to be signed by the recipient node using their private key, which you do not have.

One alternative is to actually require and use a non-BOLT-related Lightning Address which is an identifier like an email address and uses the "Pay" flow of the LNURL spec under the hood. The disadvantage of using an LNURL-related solution is that the recipient node needs to have some sort of HTTP server/proxy for the flow to work.

A native alternative that does not require the HTTP server, and only requires the recipient's node ID, is something like bLIP3 Keysend. Note that there is a downside: you cannot use the preimage and invoice signature as proof of payment as the preimage is generated by the sender. However, this might not be an issue for your donation platform, depending on your specific needs.

BOLT12 Offers (present in Core Lightning) is actively been worked on and standardised by various implementations and will solve the problems above while still providing static payment identifiers.

2
  • Welcome as a contributor :) Commented Aug 26, 2022 at 13:23
  • Thanks, Michael! Been lurking too long :)
    – dunxen
    Commented Aug 26, 2022 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.