From what I understand, the preimage is publicly revealed when the lightning payment request is paid as a part of the transaction. Is there any way to find that transaction and therefore the preimage fro the details included in the decoded payment request? The reason for this question is that I am using an app to pay lightning payment requests that does not show me the preimage in the UI, so I’m wondering if there’s any other way to retrieve it through some kind of RPC call for example. Thanks in advance.
1 Answer
From what I understand, the preimage is publicly revealed when the lightning payment request is paid as a part of the transaction.
The preimage is revealed across the route from the destination back to the source but isn't announced publicly to say all nodes on the network.
Is there any way to find that transaction and therefore the preimage fro the details included in the decoded payment request?
If you are running a Lightning node then you can query the past transactions of your node but the payment request doesn't include the preimage. The preimage is only revealed once the payment is completed.
The reason for this question is that I am using an app to pay lightning payment requests that does not show me the preimage in the UI, so I’m wondering if there’s any other way to retrieve it through some kind of RPC call for example.
If you are running a Lightning node then the preimage should be returned on payment completion. With Core Lightning the pay
RPC and keysend
RPC both return the preimage on a completed payment. If you aren't running a Lightning node then it depends on the app you are using and whether you even have a Lightning node running (it may be that the app doesn't allocate you a specific Lightning channel).
-
Thank you for your answer. You said that "the preimage is revealed across the route from the destination back to the source"--how exactly does this work? How is the preimage is communicated from the node that received the payment back to the node that sent it?– cool171Commented May 16, 2023 at 12:31
-
@cool171: The same way all messages are communicated between Lightning nodes. The Lightning protocol relies on many messages being sent back and forth between Lightning nodes. They are typically communicated via TCP. Messaging is covered in BOLT 1: github.com/lightning/bolts/blob/master/01-messaging.md. Transport is covered in BOLT 8: github.com/lightning/bolts/blob/master/08-transport.md Commented May 16, 2023 at 12:43